for part, docid in parts:
# this way, we won't display broken links
if not documents.has_key(part):
for part, docid in parts:
# this way, we won't display broken links
if not documents.has_key(part):
if form.cleaned_data['generate_dc']:
data = librarian.wrap_text(data, unicode(date.today()))
if form.cleaned_data['generate_dc']:
data = librarian.wrap_text(data, unicode(date.today()))
doc = lib.document_create(docid)
# document created, but no content yet
doc = lib.document_create(docid)
# document created, but no content yet
doc = doc.quickwrite('xml', data.encode('utf-8'),
'$AUTO$ XML data uploaded.', user=request.user.username)
except Exception,e:
doc = doc.quickwrite('xml', data.encode('utf-8'),
'$AUTO$ XML data uploaded.', user=request.user.username)
except Exception,e:
except DocumentAlreadyExists:
# Document is already there
return response.EntityConflict().django_response(\
except DocumentAlreadyExists:
# Document is already there
return response.EntityConflict().django_response(\
@hglibrary
def read(self, request, docid, lib):
"""Read document's meta data"""
@hglibrary
def read(self, request, docid, lib):
"""Read document's meta data"""
return response.BadRequest().django_response({'reason': 'name-mismatch',
'message': 'Provided revision refers, to document "%s", but provided "%s"' % (document.id, docid) })
return response.BadRequest().django_response({'reason': 'name-mismatch',
'message': 'Provided revision refers, to document "%s", but provided "%s"' % (document.id, docid) })
except (EntryNotFound, RevisionNotFound), e:
return response.EntityNotFound().django_response({
'exception': type(e), 'message': e.message})
except (EntryNotFound, RevisionNotFound), e:
return response.EntityNotFound().django_response({
'exception': type(e), 'message': e.message})
dirpath = os.path.join(settings.MEDIA_ROOT, assoc.subpath)
if not os.path.isdir(dirpath):
dirpath = os.path.join(settings.MEDIA_ROOT, assoc.subpath)
if not os.path.isdir(dirpath):
name, ext = os.path.splitext(os.path.basename(file))
if ext.lower() not in ['.png', '.jpeg', '.jpg']:
name, ext = os.path.splitext(os.path.basename(file))
if ext.lower() not in ['.png', '.jpeg', '.jpg']:
includes = [m.groupdict()['link'] for m in (re.finditer(\
XINCLUDE_REGEXP, data, flags=re.UNICODE) or []) ]
includes = [m.groupdict()['link'] for m in (re.finditer(\
XINCLUDE_REGEXP, data, flags=re.UNICODE) or []) ]
# TODO: provide useful routines to make this simpler
def xml_update_action(lib, resolve):
# TODO: provide useful routines to make this simpler
def xml_update_action(lib, resolve):
"parent_user_resivion": udoc.revision,
"parent_revision": doc.revision,
"parent_user_resivion": udoc.revision,
"parent_revision": doc.revision,
- "revision": ndoc.revision,
- 'timestamp': ndoc.revision.timestamp,
+ "revision": nudoc.revision,
+ 'timestamp': nudoc.revision.timestamp,