Dot-Notation for MediaEntry.media_type

This commit is contained in:
Elrond 2011-12-04 20:16:01 +01:00
parent 1d93996604
commit f4ee839939
3 changed files with 4 additions and 4 deletions

View File

@ -55,8 +55,8 @@ class ProcessMedia(Task):
# Try to process, and handle expected errors.
try:
#__import__(entry['media_type'])
manager = get_media_manager(entry['media_type'])
#__import__(entry.media_type)
manager = get_media_manager(entry.media_type)
manager['processor'](entry)
except BaseProcessingFail, exc:
mark_entry_failed(entry._id, exc)

View File

@ -55,7 +55,7 @@ def submit_start(request):
# create entry and save in database
entry = request.db.MediaEntry()
entry['_id'] = ObjectId()
entry['media_type'] = unicode(media_type)
entry.media_type = unicode(media_type)
entry.title = (
unicode(request.POST['title'])
or unicode(splitext(filename)[0]))

View File

@ -122,7 +122,7 @@ def media_home(request, media, page, **kwargs):
comment_form = user_forms.MediaCommentForm(request.POST)
media_template_name = get_media_manager(media['media_type'])['display_template']
media_template_name = get_media_manager(media.media_type)['display_template']
return render_to_response(
request,