From: Elrond Date: Sun, 12 Feb 2012 22:49:37 +0000 (+0100) Subject: Dot-Notation: MediaComment and some random places X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=8efcd4055804f5dba99cced70fd4fb7876a88e5e;p=mediagoblin.git Dot-Notation: MediaComment and some random places --- diff --git a/mediagoblin/tests/test_submission.py b/mediagoblin/tests/test_submission.py index 217926a4..2f11bdfb 100644 --- a/mediagoblin/tests/test_submission.py +++ b/mediagoblin/tests/test_submission.py @@ -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') diff --git a/mediagoblin/user_pages/views.py b/mediagoblin/user_pages/views.py index 05d07b1b..530dea64 100644 --- a/mediagoblin/user_pages/views.py +++ b/mediagoblin/user_pages/views.py @@ -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,