Dot-Notation: x._id = ObjectId() doesn't seem to work properly
authorElrond <elrond+mediagoblin.org@samba-tng.org>
Mon, 14 Nov 2011 16:11:37 +0000 (17:11 +0100)
committerElrond <elrond+mediagoblin.org@samba-tng.org>
Tue, 15 Nov 2011 10:32:13 +0000 (11:32 +0100)
For whatever reason, this does not work as expected:
entry._id = ObjectId()
Need to go this way:
entry['_id'] = ObjectId()

mediagoblin/submit/views.py

index bd63bd188705a70008190f17a5f59debcbb63d86..139b1d1d53ac33531f00b87b280134fcd3ee3f34 100644 (file)
@@ -52,7 +52,7 @@ def submit_start(request):
 
             # create entry and save in database
             entry = request.db.MediaEntry()
-            entry._id = ObjectId()
+            entry['_id'] = ObjectId()
             entry['title'] = (
                 unicode(request.POST['title'])
                 or unicode(splitext(filename)[0]))