Konwersja HTML do XML przed zapisaniem XML na serwer.
[redakcja.git] / apps / api / handlers / library_handlers.py
index 7e90e31..e2d986e 100755 (executable)
@@ -15,8 +15,8 @@ from django.db import IntegrityError
 import librarian
 import librarian.html
 import difflib
 import librarian
 import librarian.html
 import difflib
+import wlrepo 
 
 
-from wlrepo import *
 from explorer.models import GalleryForDocument
 
 # internal imports
 from explorer.models import GalleryForDocument
 
 # internal imports
@@ -151,7 +151,7 @@ class LibraryHandler(BaseHandler):
                     import traceback
                     # rollback branch creation
                     lib._rollback()
                     import traceback
                     # rollback branch creation
                     lib._rollback()
-                    raise LibraryException(traceback.format_exc())
+                    raise wlrepo.LibraryException(traceback.format_exc())
 
                 url = reverse('document_view', args=[doc.id])
 
 
                 url = reverse('document_view', args=[doc.id])
 
@@ -163,12 +163,12 @@ class LibraryHandler(BaseHandler):
                     url = url )            
             finally:
                 lock.release()
                     url = url )            
             finally:
                 lock.release()
-        except LibraryException, e:
+        except wlrepo.LibraryException, e:
             import traceback
             return response.InternalError().django_response({
                 "reason": traceback.format_exc()
             })
             import traceback
             return response.InternalError().django_response({
                 "reason": traceback.format_exc()
             })
-        except DocumentAlreadyExists:
+        except wlrepo.DocumentAlreadyExists:
             # Document is already there
             return response.EntityConflict().django_response({
                 "reason": "already-exists",
             # Document is already there
             return response.EntityConflict().django_response({
                 "reason": "already-exists",
@@ -178,6 +178,7 @@ class LibraryHandler(BaseHandler):
 #
 # Document Handlers
 #
 #
 # Document Handlers
 #
+
 class DiffHandler(BaseHandler):
     allowed_methods = ('GET',)
     
 class DiffHandler(BaseHandler):
     allowed_methods = ('GET',)
     
@@ -222,7 +223,7 @@ class DocumentHandler(BaseHandler):
             
         try:
             doc = lib.document(docid, user, rev=rev)
             
         try:
             doc = lib.document(docid, user, rev=rev)
-        except RevisionMismatch, e:
+        except wlrepo.RevisionMismatch, e:
             # the document exists, but the revision is bad
             return response.EntityNotFound().django_response({
                 'reason': 'revision-mismatch',
             # the document exists, but the revision is bad
             return response.EntityNotFound().django_response({
                 'reason': 'revision-mismatch',
@@ -230,7 +231,7 @@ class DocumentHandler(BaseHandler):
                 'docid': docid,
                 'user': user,
             })
                 'docid': docid,
                 'user': user,
             })
-        except RevisionNotFound, e:
+        except wlrepo.RevisionNotFound, e:
             # the user doesn't have this document checked out
             # or some other weird error occured
             # try to do the checkout
             # the user doesn't have this document checked out
             # or some other weird error occured
             # try to do the checkout
@@ -250,7 +251,7 @@ class DocumentHandler(BaseHandler):
                         'docid': docid,
                         'user': user,
                     })
                         'docid': docid,
                         'user': user,
                     })
-            except RevisionNotFound, e:
+            except wlrepo.RevisionNotFound, e:
                 return response.EntityNotFound().django_response({
                     'reason': 'document-not-found',
                     'message': e.message,
                 return response.EntityNotFound().django_response({
                     'reason': 'document-not-found',
                     'message': e.message,
@@ -313,7 +314,7 @@ class DocumentHTMLHandler(BaseHandler):
                     "with-paths": 'boolean(1)',                    
                 })
                 
                     "with-paths": 'boolean(1)',                    
                 })
                 
-        except (EntryNotFound, RevisionNotFound), e:
+        except (wlrepo.EntryNotFound, wlrepo.RevisionNotFound), e:
             return response.EntityNotFound().django_response({
                 'reason': 'not-found', 'message': e.message})
         except librarian.ValidationError, e:
             return response.EntityNotFound().django_response({
                 'reason': 'not-found', 'message': e.message})
         except librarian.ValidationError, e: