Opened 12 years ago

Last modified 6 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:


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)

trac_418_slug_generation.patch (3.2 KB ) - added by Emily O'Leary 11 years ago.
Patch to fix #418

Download all attachments as: .zip

Change History (16)

comment:1 by Christopher Allan Webber, 12 years ago

Component: component1programming
Owner: somebody removed
Status: newassigned

comment:2 by Christopher Allan Webber, 11 years ago

Keywords: sprint bitesized added

Hm. This shouldn't be hard to do afaict...

Currently we do:

                # Generate a slug from the title

In submit/ but it would be easy to move this to processing/, 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!

comment:3 by Emily O'Leary, 11 years ago

Owner: set to Emily O'Leary
Status: newaccepted

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 to stick the slug generation that seemed to be effective and so I stuck it in Thoughts?

Here is my feature branch and commit:

comment:4 by Emily O'Leary, 11 years ago

Cc: Emily O'Leary added
Owner: changed from Emily O'Leary to joar
Status: acceptedassigned

I'll assign this to joar for review since he reported it.

comment:5 by Christopher Allan Webber, 11 years ago

Keywords: review added

Marking as review

comment:6 by Christopher Allan Webber, 11 years ago

Milestone: 0.4.0

comment:7 by Elrond, 11 years ago

Keywords: sprint review removed
Milestone: 0.4.0
Owner: changed from joar to Emily O'Leary

Hi LotusEcho,

could remove the generate_slug() in plugins/api/ also?

comment:8 by Elrond, 11 years ago

Oh, and please do not use TABs for indenting. Not with python.

comment:9 by Emily O'Leary, 11 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 Christopher Allan Webber, 11 years ago

Status: assignedin_progress

by Emily O'Leary, 11 years ago

Patch to fix #418

comment:11 by Emily O'Leary, 11 years ago

Owner: Emily O'Leary removed
Status: in_progressreview

I added a patch and it's also available here ( 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 rodney757, 11 years ago

Resolution: fixed
Status: reviewclosed



comment:13 by rodney757, 11 years ago

Resolution: fixed
Status: closedaccepted

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 = ?' (u'img-0019', u'processed', 145)

I'm not sure why it trying to UPDATE on a query.

This is with sqlite.

Last edited 11 years ago by rodney757 (previous) (diff)

comment:14 by ShawnRisk, 10 years ago

Keywords: test introspection added

comment:15 by Loic Dachary, 8 years ago

After removing entry.generate_slug() from mediagoblin/api/ the tests ( ./ --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.

Note: See TracTickets for help on using tickets.