Opened 13 years ago

Last modified 13 years ago

#343 closed defect (FIXED)

Deleting media can become tricky

Reported by: Elrond Owned by: Christopher Allan Webber
Priority: minor Milestone: 0.2.0
Component: programming Keywords:
Cc: Parent Tickets:

Description

The changes in Issue `#582 </issues/582>`_ introduced some
interesting code:

::

    def user_may_delete_media(controller):
    ...
            uploader = request.db.MediaEntry.find_one(
                {'slug': request.matchdict['media']}).get_uploader()

If two people have the same slug, this query will not always do the
right thing(TM).

That said, I'd really prefer things like "edit" and "delete" use
the id instead of the slug. It just feels safer and will avoid all
these slug duplicates/etc issuess.
I don't see anyone needing to bookmark the delete page? And
bookmarking the edit page might have rare use cases, so those
should be able to live with ugly urls.

For performance/safety reasons, we could consider to have an extra
decorator for finding the media only by user/id or somesuch.



Change History (2)

comment:1 by Christopher Allan Webber, 13 years ago

Milestone: 0.2.0
Owner: set to Christopher Webber
Status: NewClosed
You're right at least for deleting... I made and pushed a fix.
Thanks so much for catching that!



comment:2 by Will Kahn-Greene, 13 years ago

The original url for this bug was http://bugs.foocorp.net/issues/695 .

Note: See TracTickets for help on using tickets.