summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
c51a084)
else:
data = request.FILES['ocr_file'].read().decode('utf-8')
else:
data = request.FILES['ocr_file'].read().decode('utf-8')
+ if data is None:
+ return response.BadRequest().django_response('You must pass ocr_data or ocr_file.')
+
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 = 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:
# rollback branch creation
lib._rollback()
# rollback branch creation
lib._rollback()
- raise LibraryException("Exception occured:" + repr(e))
+ raise LibraryException(traceback.format_exc())
url = reverse('document_view', args=[doc.id])
url = reverse('document_view', args=[doc.id])
finally:
lock.release()
except LibraryException, e:
finally:
lock.release()
except LibraryException, e:
return response.InternalError().django_response(\
return response.InternalError().django_response(\
- {'exception': repr(e) })
+ {'exception': traceback.format_exc()} )
except DocumentAlreadyExists:
# Document is already there
return response.EntityConflict().django_response(\
except DocumentAlreadyExists:
# Document is already there
return response.EntityConflict().django_response(\
resp = self.assert_json_response()
resp = self.assert_json_response()
- self.response = self.client.put(resp['text_url'], {'contents': TEXT })
+ self.response = self.client.post(resp['text_url'], {
+ 'revision': resp['user_revision'] ,'contents': TEXT })
result = self.assert_json_response(must_have={u'document': u'sample'} )
#self.response = self.client.get(result['url'])
result = self.assert_json_response(must_have={u'document': u'sample'} )
#self.response = self.client.get(result['url'])
@property
def document_name(self):
@property
def document_name(self):
- return self._docname.decode('utf-8')
+ return self._docname and self._docname.decode('utf-8')
@property
def user_name(self):
@property
def user_name(self):
- return self._username.decode('utf-8')
+ return self._username and self._username.decode('utf-8')
def hgrev(self):
return self._changectx.node()
def hgrev(self):
return self._changectx.node()