本文整理汇总了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
示例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__,
]