From ec82fbd85c93c88d177e9f5c7a7414a2b47fa17e Mon Sep 17 00:00:00 2001 From: Elrond Date: Wed, 23 Nov 2011 00:10:42 +0100 Subject: [PATCH] Dot-Notation for MediaEntry.title --- mediagoblin/db/models.py | 2 +- mediagoblin/edit/views.py | 4 ++-- mediagoblin/gmg_commands/import_export.py | 4 ++-- mediagoblin/submit/views.py | 2 +- .../mediagoblin/user_pages/media_confirm_delete.html | 2 +- .../templates/mediagoblin/user_pages/processing_panel.html | 4 ++-- mediagoblin/templates/mediagoblin/utils/object_gallery.html | 4 ++-- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/mediagoblin/db/models.py b/mediagoblin/db/models.py index f1f56dd1..7af76b9f 100644 --- a/mediagoblin/db/models.py +++ b/mediagoblin/db/models.py @@ -249,7 +249,7 @@ class MediaEntry(Document): pass def generate_slug(self): - self['slug'] = url.slugify(self['title']) + self['slug'] = url.slugify(self.title) duplicate = mg_globals.database.media_entries.find_one( {'slug': self['slug']}) diff --git a/mediagoblin/edit/views.py b/mediagoblin/edit/views.py index 0b84f639..feda397d 100644 --- a/mediagoblin/edit/views.py +++ b/mediagoblin/edit/views.py @@ -43,7 +43,7 @@ def edit_media(request, media): return exc.HTTPForbidden() defaults = dict( - title=media['title'], + title=media.title, slug=media['slug'], description=media['description'], tags=media_tags_as_string(media['tags'])) @@ -64,7 +64,7 @@ def edit_media(request, media): form.slug.errors.append( _(u'An entry with that slug already exists for this user.')) else: - media['title'] = unicode(request.POST['title']) + media.title = unicode(request.POST['title']) media['description'] = unicode(request.POST.get('description')) media['tags'] = convert_to_tag_list_of_dicts( request.POST.get('tags')) diff --git a/mediagoblin/gmg_commands/import_export.py b/mediagoblin/gmg_commands/import_export.py index 4ec17d47..1308f09e 100644 --- a/mediagoblin/gmg_commands/import_export.py +++ b/mediagoblin/gmg_commands/import_export.py @@ -67,7 +67,7 @@ def _import_media(db, args): for entry in db.media_entries.find(): for name, path in entry['media_files'].items(): _log.info('Importing: {0} - {1}'.format( - entry['title'], + entry.title, name)) media_file = mg_globals.public_store.get_file(path, mode='wb') @@ -209,7 +209,7 @@ def _export_media(db, args): for entry in db.media_entries.find(): for name, path in entry['media_files'].items(): _log.info(u'Exporting {0} - {1}'.format( - entry['title'], + entry.title, name)) try: mc_file = media_cache.get_file(path, mode='wb') diff --git a/mediagoblin/submit/views.py b/mediagoblin/submit/views.py index 64d4b541..1805e293 100644 --- a/mediagoblin/submit/views.py +++ b/mediagoblin/submit/views.py @@ -56,7 +56,7 @@ def submit_start(request): entry = request.db.MediaEntry() entry['_id'] = ObjectId() entry['media_type'] = unicode(media_type) - entry['title'] = ( + entry.title = ( unicode(request.POST['title']) or unicode(splitext(filename)[0])) diff --git a/mediagoblin/templates/mediagoblin/user_pages/media_confirm_delete.html b/mediagoblin/templates/mediagoblin/user_pages/media_confirm_delete.html index 058351a5..7c7218ae 100644 --- a/mediagoblin/templates/mediagoblin/user_pages/media_confirm_delete.html +++ b/mediagoblin/templates/mediagoblin/user_pages/media_confirm_delete.html @@ -27,7 +27,7 @@ method="POST" enctype="multipart/form-data">

- {%- trans title=media['title'] -%} + {%- trans title=media.title -%} Really delete {{ title }}? {%- endtrans %}

diff --git a/mediagoblin/templates/mediagoblin/user_pages/processing_panel.html b/mediagoblin/templates/mediagoblin/user_pages/processing_panel.html index 307a0027..a14b0123 100644 --- a/mediagoblin/templates/mediagoblin/user_pages/processing_panel.html +++ b/mediagoblin/templates/mediagoblin/user_pages/processing_panel.html @@ -36,7 +36,7 @@ {% for media_entry in processing_entries %} - {{ media_entry['title'] }} + {{ media_entry.title }} {{ media_entry.created.strftime("%m-%d-%Y %I:%M %p") }} @@ -57,7 +57,7 @@ {% for media_entry in failed_entries %} - {{ media_entry['title'] }} + {{ media_entry.title }} {{ media_entry['created'].strftime("%m-%d-%Y %I:%M %p") }} {{ media_entry.get_fail_exception().general_message }} diff --git a/mediagoblin/templates/mediagoblin/utils/object_gallery.html b/mediagoblin/templates/mediagoblin/utils/object_gallery.html index e1b8cc9b..65ff09a4 100644 --- a/mediagoblin/templates/mediagoblin/utils/object_gallery.html +++ b/mediagoblin/templates/mediagoblin/utils/object_gallery.html @@ -33,9 +33,9 @@ - {% if entry['title'] %} + {% if entry.title %}
- {{ entry['title'] }} + {{ entry.title }} {% endif %} {% endfor %} -- 2.25.1