import difflib
from librarian import dcparser, parser
-from wlrepo import *
+import wlrepo
from api.models import PullRequest
from explorer.models import GalleryForDocument
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 = url )
finally:
lock.release()
- except LibraryException, e:
+ except wlrepo.LibraryException, e:
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",
def read(self, request, docid, lib):
try:
doc = lib.document(docid)
- except RevisionNotFound:
+ except wlrepo.RevisionNotFound:
return rc.NOT_FOUND
result = {
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',
'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
'docid': docid,
'user': user,
})
- except RevisionNotFound, e:
+ except wlrepo.RevisionNotFound, e:
return response.EntityNotFound().django_response({
'reason': 'document-not-found',
'message': e.message,
@validate_form(forms.DocumentRetrieveForm, 'GET')
@hglibrary
- def read(self, request, form, docid, lib, stylesheet='partial'):
+ def read(self, request, form, docid, lib, stylesheet='full'):
"""Read document as html text"""
try:
revision = form.cleaned_data['revision']
return error
return librarian.html.transform(document.data('xml'), is_file=False, \
- parse_dublincore=False, stylesheet='full',\
+ parse_dublincore=False, stylesheet=stylesheet,\
options={
"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: