From 5c2b84869fe3f4bfe41a31ff3968bb13c6d7f868 Mon Sep 17 00:00:00 2001 From: Sebastian Spaeth Date: Fri, 30 Nov 2012 10:49:06 +0100 Subject: 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 --- mediagoblin/tools/request.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mediagoblin/tools/request.py') diff --git a/mediagoblin/tools/request.py b/mediagoblin/tools/request.py index ae372c92..66d7ffa3 100644 --- a/mediagoblin/tools/request.py +++ b/mediagoblin/tools/request.py @@ -34,7 +34,7 @@ def setup_user_in_request(request): except InvalidId: user = None else: - user = request.db.User.find_one({'_id': oid}) + user = request.db.User.find_one({'id': oid}) if not user: # Something's wrong... this user doesn't exist? Invalidate -- cgit v1.2.3