Allow .id instead of ._id for the Mongo backend

To allow easier migration to the SQLAlchemy style .id give
the User and MediaEntry mongo classes an alias attribute of
.id that maps to ['_id'].

Use it in the upload process, because this was one of the
last positions with a ['_id'] instead of ._id (due to a bug
in mongokit).
This commit is contained in:
Elrond
2011-12-25 16:01:59 +01:00
parent 9891351256
commit 58f96a13e4
2 changed files with 16 additions and 1 deletions

View File

@@ -59,7 +59,7 @@ def submit_start(request):
# create entry and save in database
entry = request.db.MediaEntry()
entry['_id'] = ObjectId()
entry.id = ObjectId()
entry.media_type = unicode(media_type)
entry.title = (
unicode(request.POST['title'])