Move DBModel._id -> DBModel.id
authorSebastian Spaeth <Sebastian@SSpaeth.de>
Fri, 30 Nov 2012 09:49:06 +0000 (10:49 +0100)
committerSebastian Spaeth <Sebastian@SSpaeth.de>
Thu, 20 Dec 2012 23:30:48 +0000 (00:30 +0100)
commit5c2b84869fe3f4bfe41a31ff3968bb13c6d7f868
tree6b2ec753c753745ee7964b9544835619b915d0f2
parent7e55bcb898d37010a5e9bd8a666cd3ddfa63de33
Move DBModel._id -> DBModel.id

We were refering to model._id in most of the code base as this is
what Mongo uses. However, each use of _id required a) fixup of queries:
e.g. what we did in our find() and find_one() functions moving all
'_id' to 'id'. It also required using AliasFields to make the ._id
attribute available. This all means lots of superfluous fixing and
transitioning in a SQL world.

It will also not work in the long run. Much newer code already refers
to the objects by model.id (e.g. in the oauth plugin), which will break
with Mongo. So let's be honest, rip out the _id mongoism and live with
.id as the one canonical way to address objects.

This commit modifies all users and providers of model._id to use
model.id instead. This patch works with or without Mongo removed first,
but will break Mongo usage (even more than before)

I have not bothered to fixup db.mongo.* and db.sql.convert
(which converts from Mongo to SQL)

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
30 files changed:
mediagoblin/auth/lib.py
mediagoblin/auth/views.py
mediagoblin/db/mixin.py
mediagoblin/db/sql/base.py
mediagoblin/db/sql/models.py
mediagoblin/decorators.py
mediagoblin/edit/lib.py
mediagoblin/edit/views.py
mediagoblin/plugins/api/views.py
mediagoblin/processing/__init__.py
mediagoblin/processing/task.py
mediagoblin/submit/views.py
mediagoblin/templates/mediagoblin/admin/panel.html
mediagoblin/templates/mediagoblin/edit/attachments.html
mediagoblin/templates/mediagoblin/edit/edit.html
mediagoblin/templates/mediagoblin/user_pages/collection.html
mediagoblin/templates/mediagoblin/user_pages/collection_item_confirm_remove.html
mediagoblin/templates/mediagoblin/user_pages/media.html
mediagoblin/templates/mediagoblin/user_pages/media_collect.html
mediagoblin/templates/mediagoblin/user_pages/media_confirm_delete.html
mediagoblin/templates/mediagoblin/user_pages/processing_panel.html
mediagoblin/templates/mediagoblin/user_pages/user.html
mediagoblin/templates/mediagoblin/utils/collection_gallery.html
mediagoblin/tests/test_auth.py
mediagoblin/tests/test_submission.py
mediagoblin/tests/tools.py
mediagoblin/tools/pagination.py
mediagoblin/tools/request.py
mediagoblin/user_pages/lib.py
mediagoblin/user_pages/views.py