From: Elrond Date: Sun, 23 Dec 2012 20:01:13 +0000 (+0100) Subject: Mongo removal: Remove the validate=True arg to obj.save() X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=b39d1f2351352fca21666137fa137eb64926a036;p=mediagoblin.git Mongo removal: Remove the validate=True arg to obj.save() all callers were forced to use validate=True anyway. So remove this useless stuff. --- diff --git a/mediagoblin/auth/views.py b/mediagoblin/auth/views.py index 7e1ad440..efd3e018 100644 --- a/mediagoblin/auth/views.py +++ b/mediagoblin/auth/views.py @@ -82,7 +82,7 @@ def register(request): user.pw_hash = auth_lib.bcrypt_gen_password_hash( request.form['password']) user.verification_key = unicode(uuid.uuid4()) - user.save(validate=True) + user.save() # log the user in request.session['user_id'] = unicode(user.id) diff --git a/mediagoblin/db/sql/base.py b/mediagoblin/db/sql/base.py index fbbac6f9..2dceca75 100644 --- a/mediagoblin/db/sql/base.py +++ b/mediagoblin/db/sql/base.py @@ -61,8 +61,7 @@ class GMGTableBase(object): # The key *has* to exist on sql. return getattr(self, key) - def save(self, validate=True): - assert validate + def save(self): sess = object_session(self) if sess is None: sess = Session() diff --git a/mediagoblin/gmg_commands/users.py b/mediagoblin/gmg_commands/users.py index 70e591c9..024c8498 100644 --- a/mediagoblin/gmg_commands/users.py +++ b/mediagoblin/gmg_commands/users.py @@ -55,7 +55,7 @@ def adduser(args): entry.pw_hash = auth_lib.bcrypt_gen_password_hash(args.password) entry.status = u'active' entry.email_verified = True - entry.save(validate=True) + entry.save() print "User created (and email marked as verified)" diff --git a/mediagoblin/plugins/api/views.py b/mediagoblin/plugins/api/views.py index 3d9437e0..4c36d110 100644 --- a/mediagoblin/plugins/api/views.py +++ b/mediagoblin/plugins/api/views.py @@ -94,7 +94,7 @@ def post_entry(request): entry.queued_task_id = task_id # Save now so we have this data before kicking off processing - entry.save(validate=True) + entry.save() if request.form.get('callback_url'): metadata = request.db.ProcessingMetaData() diff --git a/mediagoblin/submit/views.py b/mediagoblin/submit/views.py index 3628fa0d..1f0e927e 100644 --- a/mediagoblin/submit/views.py +++ b/mediagoblin/submit/views.py @@ -112,7 +112,7 @@ def submit_start(request): entry.queued_task_id = task_id # Save now so we have this data before kicking off processing - entry.save(validate=True) + entry.save() # Pass off to processing # @@ -210,7 +210,7 @@ def add_collection(request, media=None): messages.add_message( request, messages.ERROR, _('You already have a collection called "%s"!' % collection.title)) else: - collection.save(validate=True) + collection.save() add_message(request, SUCCESS, _('Collection "%s" added!' % collection.title)) diff --git a/mediagoblin/user_pages/views.py b/mediagoblin/user_pages/views.py index 33828c1b..28ef90d6 100644 --- a/mediagoblin/user_pages/views.py +++ b/mediagoblin/user_pages/views.py @@ -215,7 +215,7 @@ def media_collect(request, media): collection.description = request.form.get('collection_description') collection.creator = request.user.id collection.generate_slug() - collection.save(validate=True) + collection.save() # Otherwise, use the collection selected from the drop-down else: @@ -241,10 +241,10 @@ def media_collect(request, media): collection_item.media_entry = media.id collection_item.author = request.user.id collection_item.note = request.form['note'] - collection_item.save(validate=True) + collection_item.save() collection.items = collection.items + 1 - collection.save(validate=True) + collection.save() media.collected = media.collected + 1 media.save()