本文整理汇总了Python中types.ModuleType.portal_type方法的典型用法代码示例。如果您正苦于以下问题:Python ModuleType.portal_type方法的具体用法?Python ModuleType.portal_type怎么用?Python ModuleType.portal_type使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类types.ModuleType
的用法示例。
在下文中一共展示了ModuleType.portal_type方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: initializeDynamicModules
# 需要导入模块: from types import ModuleType [as 别名]
# 或者: from types.ModuleType import portal_type [as 别名]
def initializeDynamicModules():
"""
Create erp5 module and its submodules
erp5.portal_type
holds portal type classes
erp5.temp_portal_type
holds portal type classes for temp objects
erp5.document
holds document classes that have no physical import path,
for example classes created through ClassTool that are in
$INSTANCE_HOME/Document
erp5.accessor_holder
holds accessor holders common to ZODB Property Sheets and Portal Types
erp5.accessor_holder.property_sheet
holds accessor holders of ZODB Property Sheets
erp5.accessor_holder.portal_type
holds accessors holders of Portal Types
erp5.component:
holds ZODB Component packages
erp5.component.document:
holds Document modules previously found in bt5 in $INSTANCE_HOME/Document
erp5.component.extension:
holds Extension modules previously found in bt5 in
$INSTANCE_HOME/Extensions
erp5.component.test:
holds Live Test modules previously found in bt5 in $INSTANCE_HOME/test
"""
erp5 = ModuleType("erp5")
sys.modules["erp5"] = erp5
# Document classes without physical import path
erp5.document = ModuleType("erp5.document")
sys.modules["erp5.document"] = erp5.document
# Portal types as classes
from accessor_holder import AccessorHolderType, AccessorHolderModuleType
erp5.accessor_holder = AccessorHolderModuleType("erp5.accessor_holder")
sys.modules["erp5.accessor_holder"] = erp5.accessor_holder
erp5.accessor_holder.property_sheet = \
AccessorHolderModuleType("erp5.accessor_holder.property_sheet")
sys.modules["erp5.accessor_holder.property_sheet"] = \
erp5.accessor_holder.property_sheet
erp5.accessor_holder.portal_type = registerDynamicModule(
'erp5.accessor_holder.portal_type',
AccessorHolderModuleType)
from lazy_class import generateLazyPortalTypeClass
erp5.portal_type = registerDynamicModule('erp5.portal_type',
generateLazyPortalTypeClass)
from portal_type_class import loadTempPortalTypeClass
erp5.temp_portal_type = registerDynamicModule('erp5.temp_portal_type',
loadTempPortalTypeClass)
# ZODB Components
erp5.component = ModuleType("erp5.component")
sys.modules["erp5.component"] = erp5.component
from component_package import ComponentDynamicPackage
erp5.component.extension = ComponentDynamicPackage('erp5.component.extension',
'Extension Component')
erp5.component.document = ComponentDynamicPackage('erp5.component.document',
'Document Component')
erp5.component.test = ComponentDynamicPackage('erp5.component.test',
'Test Component')