本文整理匯總了Python中core.document_processor.DocumentProcessor.delete方法的典型用法代碼示例。如果您正苦於以下問題:Python DocumentProcessor.delete方法的具體用法?Python DocumentProcessor.delete怎麽用?Python DocumentProcessor.delete使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類core.document_processor.DocumentProcessor
的用法示例。
在下文中一共展示了DocumentProcessor.delete方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: edit_file_delete
# 需要導入模塊: from core.document_processor import DocumentProcessor [as 別名]
# 或者: from core.document_processor.DocumentProcessor import delete [as 別名]
def edit_file_delete(request, code):
"""Deletes specified code or revision from system (Marks deleted)
@param request: is a Django request object
@param code is a DMS Object() code for view interactions"""
# Decision of where to go back after or instead of removal
return_url = reverse('mdtui-home')
if 'edit_return' in request.session:
return_url = request.session['edit_return']
if request.method == 'POST':
revision = request.POST.get('revision', False)
if revision:
return_url = reverse('mdtui-edit-revisions', kwargs={'code': code})
processor = DocumentProcessor()
processor.read(code, {'user': request.user, 'only_metadata': True})
if not processor.errors:
# Selecting to delete (Mark deleted) revision or whole document
options = {'user': request.user}
if revision:
options['mark_revision_deleted'] = revision
else:
options['mark_deleted'] = True
processor.delete(code, options)
if not processor.errors:
request.session['cleanup_caches'] = True
return HttpResponseRedirect(return_url)
return HttpResponseRedirect(return_url)
示例2: delete
# 需要導入模塊: from core.document_processor import DocumentProcessor [as 別名]
# 或者: from core.document_processor.DocumentProcessor import delete [as 別名]
def delete(self, request, code, suggested_format=None):
# FIXME: should return 404 if file not found, 400 if no docrule exists.
revision, hashcode, extra = self._get_info(request)
processor = DocumentProcessor()
options = {
'revision': revision,
'extension': suggested_format,
'user': request.user,
}
log.debug('FileHandler.delete attempt with %s' % options)
processor.delete(code, options)
if len(processor.errors) > 0:
log.error('Manager Errors encountered %s' % processor.errors)
return rc.BAD_REQUEST
log.info('FileHandler.delete request fulfilled for code: %s, format: %s, rev: %s, hash: %s.' % (code, suggested_format, revision, hashcode))
return rc.DELETED