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


Python ModuleType.accessor_holder方法代码示例

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


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

示例1: initializeDynamicModules

# 需要导入模块: from types import ModuleType [as 别名]
# 或者: from types.ModuleType import accessor_holder [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')
开发者ID:leondai78,项目名称:erp5,代码行数:74,代码来源:dynamic_module.py


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