Dot-Notation for MediaEntry.title

This commit is contained in:
Elrond 2011-11-23 00:10:42 +01:00
parent 1ceb4fc868
commit ec82fbd85c
7 changed files with 11 additions and 11 deletions

View File

@ -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']})

View File

@ -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'))

View File

@ -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')

View File

@ -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]))

View File

@ -27,7 +27,7 @@
method="POST" enctype="multipart/form-data">
<div class="grid_8 prefix_1 suffix_1 edit_box form_box">
<h1>
{%- trans title=media['title'] -%}
{%- trans title=media.title -%}
Really delete {{ title }}?
{%- endtrans %}
</h1>

View File

@ -36,7 +36,7 @@
</tr>
{% for media_entry in processing_entries %}
<tr>
<td>{{ media_entry['title'] }}</td>
<td>{{ media_entry.title }}</td>
<td>{{ media_entry.created.strftime("%m-%d-%Y %I:%M %p") }}</td>
<td></td>
</tr>
@ -57,7 +57,7 @@
</tr>
{% for media_entry in failed_entries %}
<tr>
<td>{{ media_entry['title'] }}</td>
<td>{{ media_entry.title }}</td>
<td>{{ media_entry['created'].strftime("%m-%d-%Y %I:%M %p") }}</td>
<td>{{ media_entry.get_fail_exception().general_message }}</td>
</tr>

View File

@ -33,9 +33,9 @@
<img src="{{ request.app.public_store.file_url(
entry['media_files']['thumb']) }}" />
</a>
{% if entry['title'] %}
{% if entry.title %}
<br />
<a href="{{ entry_url }}">{{ entry['title'] }}</a>
<a href="{{ entry_url }}">{{ entry.title }}</a>
{% endif %}
</td>
{% endfor %}