Disable login_required.
authorRadek Czajka <radekczajka@nowoczesnapolska.org.pl>
Thu, 1 Aug 2013 09:27:21 +0000 (11:27 +0200)
committerRadek Czajka <radekczajka@nowoczesnapolska.org.pl>
Thu, 1 Aug 2013 09:27:21 +0000 (11:27 +0200)
apps/archive/tasks.py
apps/archive/templates/404.html [new file with mode: 0644]
apps/archive/templates/500.html [new file with mode: 0644]
apps/archive/templates/archive/base.html
apps/archive/templates/archive/file_managed.html
apps/archive/templatetags/tags.py
apps/archive/views.py

index ae73930..1b2be74 100644 (file)
@@ -4,6 +4,7 @@ import mimetypes
 import os
 import os.path
 import pipes
 import os
 import os.path
 import pipes
+import stat
 import subprocess
 from tempfile import NamedTemporaryFile
 from time import sleep
 import subprocess
 from tempfile import NamedTemporaryFile
 from time import sleep
@@ -58,6 +59,7 @@ class AudioFormatTask(Task):
             ExistingFile(file_name),
             save=False
             )
             ExistingFile(file_name),
             save=False
             )
+        os.chmod(getattr(audiobook, field).path, stat.S_IREAD|stat.S_IWRITE|stat.S_IRGRP|stat.S_IROTH)
         Audiobook.objects.filter(pk=audiobook.pk).update(
             **{field: getattr(audiobook, field)})
 
         Audiobook.objects.filter(pk=audiobook.pk).update(
             **{field: getattr(audiobook, field)})
 
@@ -110,7 +112,6 @@ class AudioFormatTask(Task):
         self.set_status(aid, status.TAGGING)
         self.set_tags(audiobook, out_file.name)
         self.set_status(aid, status.SENDING)
         self.set_status(aid, status.TAGGING)
         self.set_tags(audiobook, out_file.name)
         self.set_status(aid, status.SENDING)
-        self.save(audiobook, out_file.name)
 
         if publish:
             self.put(audiobook, out_file.name)
 
         if publish:
             self.put(audiobook, out_file.name)
@@ -118,6 +119,8 @@ class AudioFormatTask(Task):
         else:
             self.set_status(aid, None)
 
         else:
             self.set_status(aid, None)
 
+        self.save(audiobook, out_file.name)
+
     def on_failure(self, exc, task_id, args, kwargs, einfo):
         aid = (args[0], kwargs.get('aid'))[0]
         self.set_status(aid, None)
     def on_failure(self, exc, task_id, args, kwargs, einfo):
         aid = (args[0], kwargs.get('aid'))[0]
         self.set_status(aid, None)
diff --git a/apps/archive/templates/404.html b/apps/archive/templates/404.html
new file mode 100644 (file)
index 0000000..467dacd
--- /dev/null
@@ -0,0 +1,6 @@
+{% extends "archive/base.html" %}
+{% block content %}
+<h1>Nie znaleziono strony.</h1>
+
+<p>Nie znaleziono żądanej strony.</p>
+{% endblock %}
diff --git a/apps/archive/templates/500.html b/apps/archive/templates/500.html
new file mode 100644 (file)
index 0000000..b46280d
--- /dev/null
@@ -0,0 +1 @@
+Błąd serwera.
index 5d28312..575cf8e 100644 (file)
     {% if user.is_staff %}
         <a href='{% url admin:archive_project_changelist %}'>{% trans "Projects" %}</a>
     {% endif %}
     {% if user.is_staff %}
         <a href='{% url admin:archive_project_changelist %}'>{% trans "Projects" %}</a>
     {% endif %}
-    <a href="{% url logout %}" style='float: right;'>{% trans "Logout" %}</a>
+    {% if user.is_authenticated %}
+        <a href="{% url logout %}" style='float: right;'>{% trans "Logout" %}</a>
+    {% else %}
+        <a href="{% url login %}" style='float: right;'>{% trans "Login" %}</a>
+    {% endif %}
     {% if user.is_staff %}
         <a href='{% url admin:index %}' style='float: right;'>{% trans "Administration" %}</a>
     {% endif %}
     {% if user.is_staff %}
         <a href='{% url admin:index %}' style='float: right;'>{% trans "Administration" %}</a>
     {% endif %}
-    <span style='float: right;'>{{ user }}</span>
+    {% if user.is_authenticated %}
+        <span style='float: right;'>{{ user }}</span>
+    {% endif %}
     <div class='clr' ></div>
 {% endblock %}
     <div class='clr' ></div>
 {% endblock %}
index 01847a6..58f45ef 100755 (executable)
@@ -68,7 +68,9 @@
     <p><a href="{% url download audiobook.id 'mp3' %}">{% trans "Download MP3 file." %}</a></p>
     {% if audiobook.mp3_published %}
         <p>{% trans "Published:" %} {{ audiobook.mp3_published }}</a></p>
     <p><a href="{% url download audiobook.id 'mp3' %}">{% trans "Download MP3 file." %}</a></p>
     {% if audiobook.mp3_published %}
         <p>{% trans "Published:" %} {{ audiobook.mp3_published }}</a></p>
-        {% tags_table audiobook.mp3_published_tags.tags %}
+        {% if audiobook.mp3_published_tags.tags %}
+            {% tags_table audiobook.mp3_published_tags.tags %}
+        {% endif %}
     {% else %}
         <p>{% trans "Not published yet." %}</p>
     {% endif %}
     {% else %}
         <p>{% trans "Not published yet." %}</p>
     {% endif %}
@@ -82,7 +84,9 @@
     <p><a href="{% url download audiobook.id 'ogg' %}">{% trans "Download Ogg Vorbis file." %}</a></p>
     {% if audiobook.ogg_published %}
         <p>{% trans "Published:" %} {{ audiobook.ogg_published }}</a></p>
     <p><a href="{% url download audiobook.id 'ogg' %}">{% trans "Download Ogg Vorbis file." %}</a></p>
     {% if audiobook.ogg_published %}
         <p>{% trans "Published:" %} {{ audiobook.ogg_published }}</a></p>
-        {% tags_table audiobook.ogg_published_tags.tags %}
+        {% if audiobook.ogg_published_tags.tags %}
+            {% tags_table audiobook.ogg_published_tags.tags %}
+        {% endif %}
     {% else %}
         <p>{% trans "Not published yet." %}</p>
     {% endif %}
     {% else %}
         <p>{% trans "Not published yet." %}</p>
     {% endif %}
index 479443b..8e208a6 100755 (executable)
@@ -16,4 +16,6 @@ def multiple_tags_table(tags, table=True):
 
 @register.inclusion_tag('archive/tags/tags_table.html')
 def tags_table(tags, table=True):
 
 @register.inclusion_tag('archive/tags/tags_table.html')
 def tags_table(tags, table=True):
+    if tags is None:
+        tags = {}
     return locals()
     return locals()
index e76da74..d40f633 100644 (file)
@@ -7,7 +7,7 @@ from urllib import quote
 
 from archive import settings
 from django.contrib.auth import logout
 
 from archive import settings
 from django.contrib.auth import logout
-from django.contrib.auth.decorators import login_required, permission_required
+from django.contrib.auth.decorators import permission_required
 from django.core.urlresolvers import reverse
 from django.db.models import Q, Max
 from django.http import Http404, HttpResponse
 from django.core.urlresolvers import reverse
 from django.db.models import Q, Max
 from django.http import Http404, HttpResponse
@@ -23,7 +23,6 @@ from archive import tasks
 from archive.utils import all_files
 
 
 from archive.utils import all_files
 
 
-@login_required
 def list_new(request):
     division = 'new'
 
 def list_new(request):
     division = 'new'
 
@@ -200,7 +199,6 @@ def download(request, aid, which="source"):
     return response
 
 
     return response
 
 
-@login_required
 def list_unpublished(request):
     division = 'unpublished'
 
 def list_unpublished(request):
     division = 'unpublished'
 
@@ -208,7 +206,6 @@ def list_unpublished(request):
     return render(request, "archive/list_unpublished.html", locals())
 
 
     return render(request, "archive/list_unpublished.html", locals())
 
 
-@login_required
 def list_publishing(request):
     division = 'publishing'
 
 def list_publishing(request):
     division = 'publishing'
 
@@ -226,7 +223,6 @@ def list_publishing(request):
     return render(request, "archive/list_publishing.html", locals())
 
 
     return render(request, "archive/list_publishing.html", locals())
 
 
-@login_required
 def list_published(request):
     division = 'published'
 
 def list_published(request):
     division = 'published'
 
@@ -258,7 +254,6 @@ def file_managed(request, id):
     return render(request, "archive/file_managed.html", locals())
 
 
     return render(request, "archive/file_managed.html", locals())
 
 
-@login_required
 def list_unmanaged(request):
     division = 'unmanaged'
 
 def list_unmanaged(request):
     division = 'unmanaged'
 
@@ -266,7 +261,6 @@ def list_unmanaged(request):
     return render(request, "archive/list_unmanaged.html", locals())
 
 
     return render(request, "archive/list_unmanaged.html", locals())
 
 
-@login_required
 def file_unmanaged(request, filename):
     division = 'unmanaged'
 
 def file_unmanaged(request, filename):
     division = 'unmanaged'