当前位置: 首页>>代码示例>>Python>>正文


Python DocumentProcessor.delete方法代码示例

本文整理汇总了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)
开发者ID:egon0,项目名称:Adlibre-DMS,代码行数:30,代码来源:views.py

示例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
开发者ID:garmoncheg,项目名称:Adlibre-DMS,代码行数:18,代码来源:handlers.py


注:本文中的core.document_processor.DocumentProcessor.delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。