Dot-Notation: MediaComment and some random places
authorElrond <elrond+mediagoblin.org@samba-tng.org>
Sun, 12 Feb 2012 22:49:37 +0000 (23:49 +0100)
committerElrond <elrond+mediagoblin.org@samba-tng.org>
Sun, 26 Feb 2012 18:19:48 +0000 (19:19 +0100)
mediagoblin/tests/test_submission.py
mediagoblin/user_pages/views.py

index 217926a41807094cda9a19455ac533e747d9569a..2f11bdfbd726351d9d0f2ff06e3bf24381243ac5 100644 (file)
@@ -140,7 +140,7 @@ class TestSubmission:
         context = template.TEMPLATE_TEST_CONTEXT['mediagoblin/user_pages/user.html']
         request = context['request']
         media = request.db.MediaEntry.find({'title': 'Balanced Goblin'})[0]
-        assert_equal(media['tags'],
+        assert_equal(media.tags,
                      [{'name': u'yin', 'slug': u'yin'},
                                             {'name': u'yang', 'slug': u'yang'}])
 
@@ -255,7 +255,7 @@ class TestSubmission:
             {'title': 'Malicious Upload 2'})
         assert_equal(entry.state, 'failed')
         assert_equal(
-            entry['fail_error'],
+            entry.fail_error,
             u'mediagoblin.processing:BadMediaFail')
 
         # Test non-supported file with .png extension
@@ -275,5 +275,5 @@ class TestSubmission:
             {'title': 'Malicious Upload 3'})
         assert_equal(entry.state, 'failed')
         assert_equal(
-            entry['fail_error'],
+            entry.fail_error,
             u'mediagoblin.processing:BadMediaFail')
index 05d07b1bfe5134333a756b2c29199eec24ede38d..530dea6470feac6e9e22954ea70f64f21ba18930 100644 (file)
@@ -142,11 +142,11 @@ def media_post_comment(request, media):
     assert request.method == 'POST'
 
     comment = request.db.MediaComment()
-    comment['media_entry'] = media._id
-    comment['author'] = request.user._id
-    comment['content'] = unicode(request.POST['comment_content'])
+    comment.media_entry = media.id
+    comment.author = request.user.id
+    comment.content = unicode(request.POST['comment_content'])
 
-    if not comment['content'].strip():
+    if not comment.content.strip():
         messages.add_message(
             request,
             messages.ERROR,