Opened 14 years ago
Last modified 8 years ago
#418 accepted defect
Leave slug empty until we are sure media processing was successful
| Reported by: | joar | Owned by: | |
|---|---|---|---|
| Priority: | major | Milestone: | |
| Component: | programming | Keywords: | post-sql bitesized test introspection |
| Cc: | Emily O'Leary | Parent Tickets: |
Description
We should leave the slug field of a media entry empty until we are done processing and only set it if processing was successful.
Attachments (1)
Change History (16)
comment:1 by , 13 years ago
| Component: | component1 → programming |
|---|---|
| Owner: | removed |
| Status: | new → assigned |
comment:2 by , 13 years ago
| Keywords: | sprint bitesized added |
|---|
comment:3 by , 13 years ago
| Owner: | set to |
|---|---|
| Status: | new → accepted |
I took a crack at this. I dived right into the processing code (side note: in my dev instance I could upload videos for some reason. I tried webm, flv, mp4, and 3gp.
I couldn't find a good place in init.py to stick the slug generation that seemed to be effective and so I stuck it in task.py. Thoughts?
Here is my feature branch and commit: https://gitorious.org/~lotusecho/mediagoblin/lotusechos-mediagoblin/commit/97c9efaf47d5c5bfee33bf250567cec96a231488
comment:4 by , 13 years ago
| Cc: | added |
|---|---|
| Owner: | changed from to |
| Status: | accepted → assigned |
I'll assign this to joar for review since he reported it.
comment:6 by , 13 years ago
| Milestone: | → 0.4.0 |
|---|
comment:7 by , 12 years ago
| Keywords: | sprint review removed |
|---|---|
| Milestone: | 0.4.0 |
| Owner: | changed from to |
Hi LotusEcho,
could remove the generate_slug() in plugins/api/views.py also?
comment:9 by , 12 years ago
I'll have to change my settings to convert my TABs, thanks for the tip. :)
I'll look at that bit you mentioned.
comment:10 by , 12 years ago
| Status: | assigned → in_progress |
|---|
comment:11 by , 12 years ago
| Owner: | removed |
|---|---|
| Status: | in_progress → review |
I added a patch and it's also available here (https://gitorious.org/~lotusecho/mediagoblin/lotusechos-mediagoblin/commit/8b25f7139bdd8180947fe36dba0cebf80b94c74f). Although my re-basing didn't quite go as planned so it added more commits to it than it should have so it was a bit unwieldy there.
comment:13 by , 12 years ago
| Resolution: | fixed |
|---|---|
| Status: | closed → accepted |
Okay, so I didn't test this well enough and am getting a really strange error when trying to upload an image with the same title as another image, so I reverted the commits and am reopening this until we can figure out what is wrong.
For some reason the query in check_media_slug_used is giving me an integrity error when doing query.first():
IntegrityError) columns uploader, slug are not unique u'UPDATE core__media_entries SET slug=?, state=? WHERE core__media_entries.id = ?' (u'img-0019', u'processed', 145)
I'm not sure why it trying to UPDATE on a query.
This is with sqlite.
comment:14 by , 11 years ago
| Keywords: | test introspection added |
|---|
comment:15 by , 10 years ago
After removing entry.generate_slug() from mediagoblin/api/views.py the tests ( ./runtests.sh --cov-report=term-missing --cov=mediagoblin mediagoblin/tests ) pass with success, meaning it is not tested. Before modifying the code it seems necessary to add test coverage verifying the slug exists when it should and duplicates raise the appropriate errors.

Hm. This shouldn't be hard to do afaict...
Currently we do:
# Generate a slug from the title entry.generate_slug()In submit/views.py but it would be easy to move this to processing/init.py, after processing ends.
This is a bitesized task, good for a new contributor who's willing to learn how processing works. Good sprint task, too!