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


Python DirectoryView.registerFileExtension方法代码示例

本文整理汇总了Python中Products.CMFCore.DirectoryView.registerFileExtension方法的典型用法代码示例。如果您正苦于以下问题:Python DirectoryView.registerFileExtension方法的具体用法?Python DirectoryView.registerFileExtension怎么用?Python DirectoryView.registerFileExtension使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Products.CMFCore.DirectoryView的用法示例。


在下文中一共展示了DirectoryView.registerFileExtension方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _updateFromFS

# 需要导入模块: from Products.CMFCore import DirectoryView [as 别名]
# 或者: from Products.CMFCore.DirectoryView import registerFileExtension [as 别名]
        self._readMetadata()

    def _updateFromFS(self):
        # workaround for Python 2.1 multiple inheritance lameness
        return self._baseUpdateFromFS()

    def _readMetadata(self):
        # workaround for Python 2.1 multiple inheritance lameness
        return self._baseReadMetadata()

    def __call__(self, *args, **kwargs):
        return self._call(FSPageTemplate.__call__, *args, **kwargs)

InitializeClass(FSPageTemplate)
InitializeClass(FSControllerPageTemplate)

DirectoryView.registerFileExtension('pt', FSPageTemplate)
DirectoryView.registerFileExtension('zpt', FSPageTemplate)
DirectoryView.registerFileExtension('html', FSPageTemplate)
DirectoryView.registerFileExtension('htm', FSPageTemplate)
DirectoryView.registerFileExtension('cpt', FSControllerPageTemplate)

DirectoryView.registerMetaType('Page Template', FSPageTemplate)
DirectoryView.registerMetaType('Controller Page Template', FSControllerPageTemplate)

# Patch the ignore list, so that our .py source files don't show up in skins
# folders
old_ignore = DirectoryView.ignore_re
new_ignore_re = re.compile(r'\.|(.*~$)|#|(.*\.(.?pt|htm.?)\.py$)')
DirectoryView.ignore_re = new_ignore_re
开发者ID:jean,项目名称:cmf.pt,代码行数:32,代码来源:fs.py

示例2: getattr

# 需要导入模块: from Products.CMFCore import DirectoryView [as 别名]
# 或者: from Products.CMFCore.DirectoryView import registerFileExtension [as 别名]
            filelist != getattr(self, '_v_last_filelist', None)):
            self._v_last_read = mtime
            self._v_last_filelist = filelist

            return 1
        return 0


class PatchedFSFile(FSFile.FSFile):
    """ Custom FS File
    """
    manage_options = ({'label':'Properties', 'action':'manage_main'},)

    manage_main = DirectoryView.DirectoryViewSurrogate.manage_propertiesForm


def registerDirectory(filepath, prj=PROJECTNAME):
    """ Register file-system directory
    """
    return DirectoryView._dirreg.registerDirectoryByKey(filepath, prj)


DirectoryView.registerFileExtension('pdf', PatchedFSFile)
DirectoryView.registerFileExtension('epub', PatchedFSFile)
DirectoryView.registerFileExtension('lock', PatchedFSFile)

__all__ = [
    createDirectoryView.__name__,
    registerDirectory.__name__,
]
开发者ID:collective,项目名称:eea.downloads,代码行数:32,代码来源:DirectoryView.py


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