update librarian
[redakcja.git] / apps / catalogue / views.py
index b30297c..3d1a47f 100644 (file)
@@ -204,18 +204,27 @@ def upload(request):
     })
 
 
     })
 
 
-@never_cache
-def book_xml(request, slug):
-    book = get_object_or_404(Book, slug=slug)
+def serve_xml(request, book, slug):
     if not book.accessible(request):
         return HttpResponseForbidden("Not authorized.")
     if not book.accessible(request):
         return HttpResponseForbidden("Not authorized.")
-    xml = book.materialize()
-
+    xml = book.materialize(publishable=True)
     response = http.HttpResponse(xml, content_type='application/xml')
     response['Content-Disposition'] = 'attachment; filename=%s.xml' % slug
     return response
 
 
     response = http.HttpResponse(xml, content_type='application/xml')
     response['Content-Disposition'] = 'attachment; filename=%s.xml' % slug
     return response
 
 
+@never_cache
+def book_xml(request, slug):
+    book = get_object_or_404(Book, slug=slug)
+    return serve_xml(request, book, slug)
+
+
+@never_cache
+def book_xml_dc(request, slug):
+    book = get_object_or_404(Book, dc_slug=slug)
+    return serve_xml(request, book, slug)
+
+
 @never_cache
 def book_txt(request, slug):
     book = get_object_or_404(Book, slug=slug)
 @never_cache
 def book_txt(request, slug):
     book = get_object_or_404(Book, slug=slug)
@@ -562,7 +571,7 @@ def publish(request, slug):
     except NotAuthorizedError:
         return http.HttpResponseRedirect(reverse('apiclient_oauth'))
     except BaseException, e:
     except NotAuthorizedError:
         return http.HttpResponseRedirect(reverse('apiclient_oauth'))
     except BaseException, e:
-        return http.HttpResponse(e)
+        return http.HttpResponse(repr(e))
     else:
         return http.HttpResponseRedirect(book.get_absolute_url())
 
     else:
         return http.HttpResponseRedirect(book.get_absolute_url())