Dot-Notation for MediaEntry.media_files
authorElrond <elrond+mediagoblin.org@samba-tng.org>
Wed, 4 Jan 2012 10:57:08 +0000 (11:57 +0100)
committerElrond <elrond+mediagoblin.org@samba-tng.org>
Wed, 4 Jan 2012 10:57:39 +0000 (11:57 +0100)
mediagoblin/gmg_commands/import_export.py
mediagoblin/media_types/video/processing.py
mediagoblin/templates/mediagoblin/edit/attachments.html
mediagoblin/templates/mediagoblin/edit/edit.html
mediagoblin/templates/mediagoblin/media_displays/ascii.html
mediagoblin/templates/mediagoblin/media_displays/video.html
mediagoblin/templates/mediagoblin/user_pages/media.html
mediagoblin/templates/mediagoblin/user_pages/media_confirm_delete.html
mediagoblin/templates/mediagoblin/utils/object_gallery.html
mediagoblin/tools/files.py

index eda41f4c13d2325d5f9add431234e22e56116b0a..7f69942904f8ad372a96a606c8872b93d76e3f39 100644 (file)
@@ -65,7 +65,7 @@ def _import_media(db, args):
         args._cache_path['queue'])
 
     for entry in db.MediaEntry.find():
-        for name, path in entry['media_files'].items():
+        for name, path in entry.media_files.items():
             _log.info('Importing: {0} - {1}'.format(
                     entry.title,
                     name))
@@ -207,7 +207,7 @@ def _export_media(db, args):
         args._cache_path['queue'])
 
     for entry in db.MediaEntry.find():
-        for name, path in entry['media_files'].items():
+        for name, path in entry.media_files.items():
             _log.info(u'Exporting {0} - {1}'.format(
                     entry.title,
                     name))
index 7d261226c76a8dc05d6508ce50f91b99ee34949c..c260cfd653c67c3fafa1a0f7741e7503ad6c428c 100644 (file)
@@ -74,7 +74,7 @@ def process_video(entry):
             tmp_dst.read())
         _log.debug('Saved medium')
 
-        entry['media_files']['webm_640'] = medium_filepath
+        entry.media_files['webm_640'] = medium_filepath
 
         # Save the width and height of the transcoded video
         entry.media_data['video'] = {
@@ -94,7 +94,7 @@ def process_video(entry):
             tmp_thumb.read())
         _log.debug('Saved thumbnail')
 
-        entry['media_files']['thumb'] = thumbnail_filepath
+        entry.media_files['thumb'] = thumbnail_filepath
 
     if video_config['keep_original']:
         # Push original file to public storage
@@ -111,7 +111,7 @@ def process_video(entry):
                 original_file.write(queued_file.read())
                 _log.debug('Saved original')
 
-                entry['media_files']['original'] = original_filepath
+                entry.media_files['original'] = original_filepath
 
     mgg.queue_store.delete_file(queued_filepath)
 
index 124d03138681b91986204cd6bab737433682b8e1..06062cd339fd5b06bcd7c8dc83dbca172b208776 100644 (file)
@@ -27,7 +27,7 @@
       <h1>Editing attachments for {{ media.title }}</h1>
       <div style="text-align: center;" >
         <img src="{{ request.app.public_store.file_url(
-                         media['media_files']['thumb']) }}" />
+                         media.media_files['thumb']) }}" />
       </div>
 
       {% if media.attachment_files|count %}
index 2dfaddc8cc86ca1ff59e7c8a7383b46f0e4c0f14..024a2b4d9b8de460cad78d8c7335e108b9dd6ba2 100644 (file)
@@ -29,7 +29,7 @@
       <h1>{% trans media_title=media.title %}Editing {{ media_title }}{% endtrans %}</h1>
       <div style="text-align: center;" >
         <img src="{{ request.app.public_store.file_url(
-                         media['media_files']['thumb']) }}" />
+                         media.media_files['thumb']) }}" />
       </div>
       {{ wtforms_util.render_divs(form) }}
       <div class="form_submit_buttons">
index 9e77066acbf7dfdfe2a54382cd2d91d4aa3aa5f4..6b40bf08f76d4db003f6a48e7bdf44129ceee7e2 100644 (file)
     <pre>
       {%- autoescape False -%}
       {{- request.app.public_store.get_file(
-             media['media_files']['unicode']).read()|string -}}
+             media.media_files['unicode']).read()|string -}}
       {%- endautoescape -%}
     </pre>
   </div>
   {% if 'original' in media.media_files %}
   <p>
     <a href="{{ request.app.public_store.file_url(
-            media['media_files']['original']) }}">
+            media.media_files['original']) }}">
       {%- trans -%}
         Original
       {%- endtrans -%}
index fc08f96303c8defeb8acefa0849187c4d816d14c..6b5e7a0e553c15e6f0df5e803f46eb67f1f2b20a 100644 (file)
@@ -27,7 +27,7 @@
           preload="auto"
           data-setup="">
       <source src="{{ request.app.public_store.file_url(
-                  media['media_files']['webm_640']) }}" 
+                  media.media_files['webm_640']) }}" 
              type="video/webm; codecs=&quot;vp8, vorbis&quot;" />
          <div class="no_html5">
            {%- trans -%}Sorry, this video will not work because 
@@ -42,7 +42,7 @@
   {% if 'original' in media.media_files %}
   <p>
     <a href="{{ request.app.public_store.file_url(
-            media['media_files']['original']) }}">
+            media.media_files['original']) }}">
       {%- trans -%}
         Original
       {%- endtrans -%}
index ca650f6350ee750dbd14a346b5a0ded39cf2b1e1..d52f544ff5d133275133b9dadd6497b67087fb74 100644 (file)
@@ -36,9 +36,9 @@
         {# if there's a medium file size, that means the medium size
          #  isn't the original... so link to the original!
          #}
-        {% if media['media_files'].has_key('medium') %}
+        {% if media.media_files.has_key('medium') %}
           <a href="{{ request.app.public_store.file_url(
-                        media['media_files']['original']) }}">
+                        media.media_files['original']) }}">
             <img class="media_image"
                  src="{{ display_media }}"
                  alt="Image for {{ media.title }}" />
index 6c483769139cedd94e794582a4b245f84c5b8da5..408bca05b6f03e3d9671232b81ac8699d2d32474 100644 (file)
@@ -34,7 +34,7 @@
          
       <div style="text-align: center;" >
         <img src="{{ request.app.public_store.file_url(
-                         media['media_files']['thumb']) }}" />
+                         media.media_files['thumb']) }}" />
       </div>
          
       <br />
index b8155f03aab1a11f0924393cc595c88398a10a49..5f628dc758ab9e89bcdf9f048f7c3effd51ebc2e 100644 (file)
@@ -31,7 +31,7 @@
                      {%- elif loop.last %} thumb_entry_last{% endif %}">
             <a href="{{ entry_url }}">
               <img src="{{ request.app.public_store.file_url(
-                             entry['media_files']['thumb']) }}" />
+                             entry.media_files['thumb']) }}" />
             </a>
             {% if entry.title %}
               <br />
index e0bf0569f01703ac264845e1fd30b98f3d8aab20..10f1d994a3b9d9e0c141d0b40b00284f1b345796 100644 (file)
@@ -23,7 +23,7 @@ def delete_media_files(media):
     Arguments:
      - media: A MediaEntry document
     """
-    for listpath in media['media_files'].itervalues():
+    for listpath in media.media_files.itervalues():
         mg_globals.public_store.delete_file(
             listpath)