]> git.parisson.com Git - telemeta.git/commitdiff
fix mimetype analyzer (telemeta side), fix csrf for login, (re)add TEMPLATE_CONTEXT_P...
authoryomguy <yomguy@parisson.com>
Mon, 31 Jan 2011 09:37:26 +0000 (10:37 +0100)
committeryomguy <yomguy@parisson.com>
Mon, 31 Jan 2011 09:37:26 +0000 (10:37 +0100)
INSTALL
telemeta/admin.py
telemeta/templates/telemeta_default/login.html
telemeta/web/base.py

diff --git a/INSTALL b/INSTALL
index a7c579675d2ad4bd158c2e9b8fbcb720659a1aed..e3c4fc5f599d787186891380be4c7b4e9321acfb 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -114,11 +114,15 @@ Edit the file settings.py in a text editor.
 Modifiy the following variables:
 
     ADMINS =            telemeta requires that you indicate an administrator here
-    DATABASE_* =        your database settings (don't forget to create the database if needed)
+    DATABASES =         your database setting dict (don't forget to create the database if needed)
     MEDIA_ROOT =        absolute path to the media directory you just created
     INSTALLED_APPS =    add 'telemeta' to the tuple
     
 Add the following variables:
+    
+    TEMPLATE_CONTEXT_PROCESSORS = (
+        'django.core.context_processors.request',
+        'django.core.context_processors.auth',)
 
     TELEMETA_ORGANIZATION =  name of the organization which hosts this installation
     TELEMETA_SUBJECTS =      tuple of subject keywords (used for Dublin Core), such as "Ethnology", etc...
index 9972629ecd412c653234982598922f73533832aa..73d511fd74f216e70e83eef1bb9e8dc9801fbb33 100644 (file)
@@ -1,6 +1,8 @@
 from telemeta.models.media import MediaCollection, MediaItem
+from telemeta.models.system import User
 from django.contrib import admin
 
 admin.site.register(MediaCollection)
 admin.site.register(MediaItem)
+admin.site.register(User)
 
index e408425468307fd8a4e54d5abcc7178286b74f38..dcf7f4c0ee1fce2be1166a8ed261e405e7ed47c5 100644 (file)
@@ -8,7 +8,7 @@
 <p class="login-error">{% trans "Your username and password didn't match. Please try again." %}</p>
 {% endif %}
 
-<form class="login" method="post" action="{% url telemeta-login %}">
+<form class="login" method="post" action="{% url telemeta-login %}">{% csrf_token %}
 <p>
 {{ form.username.label_tag }}
 {{ form.username }}<br />
index bfa1ec7c01d0a41942ec5eed085c01931d6153af..50c00dbe14d219e99ca5b3535ce931dd6a27bb68 100644 (file)
@@ -47,6 +47,7 @@ from django.views.generic import list_detail
 from django.conf import settings
 from django.contrib import auth
 from django.contrib.auth.decorators import login_required
+from django.core.context_processors import csrf
 
 from telemeta.models import MediaItem, Location, MediaCollection, EthnicGroup
 from telemeta.models import dublincore, Enumeration
@@ -144,7 +145,6 @@ class WebView(object):
             if item.file:
                 decoder  = timeside.decoder.FileDecoder(item.file.path)
                 pipe = decoder
-                mime_type = decoder.mimetype
                 
                 for analyzer in self.analyzers:
                     subpipe = analyzer()
@@ -153,6 +153,9 @@ class WebView(object):
                     
                 pipe.run()
                 
+                mime_type = decoder.format()
+                analyzers.append({'name': 'Mime type', 'id': 'mime_type', 'unit': '', 'value': mime_type})
+                    
                 for analyzer in analyzers_sub:
                     value = analyzer.result()
                     if analyzer.id() == 'duration':
@@ -160,14 +163,12 @@ class WebView(object):
                         item.approx_duration = approx_value
                         item.save()
                         value = datetime.timedelta(0,value)
-                    if analyzer.id() == 'mime_type':
-                        value = decoder.format()
                         
                     analyzers.append({'name':analyzer.name(),
                                       'id':analyzer.id(),
                                       'unit':analyzer.unit(),
                                       'value':str(value)})
-                
+                  
             self.cache.write_analyzer_xml(analyzers, analyze_file)