diff options
author | Jessica Tallon <tsyesika@tsyesika.se> | 2015-10-07 13:13:40 +0200 |
---|---|---|
committer | Jessica Tallon <tsyesika@tsyesika.se> | 2015-10-07 15:07:54 +0200 |
commit | d216d771f662fc3e0a3417ce06e8355abce99988 (patch) | |
tree | 7502682047ad22ec40d13d18ffb84a284d1e92ac /mediagoblin/submit/lib.py | |
parent | bc75a6532712e4b9b0f6d8b5bbd93db3ef58335d (diff) | |
download | mediagoblin-d216d771f662fc3e0a3417ce06e8355abce99988.tar.lz mediagoblin-d216d771f662fc3e0a3417ce06e8355abce99988.tar.xz mediagoblin-d216d771f662fc3e0a3417ce06e8355abce99988.zip |
Add public_id fixes throughout the code
This adds several things, mainly code which checks for the public id and
if it doesn't exist generating it where it can. This is to because we
need to keep the public_id to be able to effectively soft delete models.
This also adds a public_id field to the Activity along with a migration.
Diffstat (limited to 'mediagoblin/submit/lib.py')
-rw-r--r-- | mediagoblin/submit/lib.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/mediagoblin/submit/lib.py b/mediagoblin/submit/lib.py index 77dd836b..eee5653f 100644 --- a/mediagoblin/submit/lib.py +++ b/mediagoblin/submit/lib.py @@ -104,9 +104,7 @@ def submit_media(mg_app, user, submitted_file, filename, title=None, description=None, license=None, metadata=None, tags_string=u"", upload_limit=None, max_file_size=None, - callback_url=None, - # If provided we'll do the feed_url update, otherwise ignore - urlgen=None,): + callback_url=None, urlgen=None,): """ Args: - mg_app: The MediaGoblinApp instantiated for this process @@ -124,7 +122,8 @@ def submit_media(mg_app, user, submitted_file, filename, - upload_limit: size in megabytes that's the per-user upload limit - max_file_size: maximum size each file can be that's uploaded - callback_url: possible post-hook to call after submission - - urlgen: if provided, used to do the feed_url update + - urlgen: if provided, used to do the feed_url update and assign a public + ID used in the API (very important). """ if upload_limit and user.uploaded >= upload_limit: raise UserPastUploadLimit() @@ -189,6 +188,11 @@ def submit_media(mg_app, user, submitted_file, filename, metadata.save() if urlgen: + # Generate the public_id, this is very importent, especially relating + # to deletion, it allows the shell to be accessable post-delete! + entry.get_public_id(urlgen) + + # Generate the feed URL feed_url = urlgen( 'mediagoblin.user_pages.atom_feed', qualified=True, user=user.username) |