Opened 11 years ago
Last modified 5 years ago
#418 accepted defect
Leave slug empty until we are sure media processing was successful
|Reported by:||joar||Owned by:|
|Component:||programming||Keywords:||post-sql bitesized test introspection|
|Cc:||Emily O'Leary||Parent Tickets:|
We should leave the slug field of a media entry empty until we are done processing and only set it if processing was successful.
Change History (16)
comment:1 by , 11 years ago
|Component:||component1 → programming|
|Status:||new → assigned|
comment:2 by , 10 years ago
|Keywords:||sprint bitesized added|
comment:3 by , 10 years ago
|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 , 10 years ago
|Status:||accepted → assigned|
I'll assign this to joar for review since he reported it.
comment:5 by , 10 years ago
Marking as review
comment:6 by , 10 years ago
comment:7 by , 10 years ago
|Keywords:||sprint review removed|
could remove the
comment:8 by , 10 years ago
Oh, and please do not use TABs for indenting. Not with python.
comment:9 by , 10 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 , 10 years ago
|Status:||assigned → in_progress|
by , 10 years ago
Patch to fix #418
comment:11 by , 10 years ago
|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:12 by , 10 years ago
|Status:||review → closed|
comment:13 by , 10 years ago
|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
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 , 9 years ago
|Keywords:||test introspection added|
comment:15 by , 7 years ago
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:
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!