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


Python Folder._getOb方法代码示例

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


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

示例1: addWikiFromFs

# 需要导入模块: from OFS.Folder import Folder [as 别名]
# 或者: from OFS.Folder.Folder import _getOb [as 别名]
def addWikiFromFs(self, new_id, title='', wiki_type='zwikidotorg',
                      REQUEST=None):
    """
    Create a new zwiki web from the specified template on the filesystem.
    """
    parent = self.Destination()
    # Go with a BTreeFolder from the start to avoid hassle with large
    # wikis on low-memory hosted servers ?
    #parent.manage_addProduct['BTreeFolder2'].manage_addBTreeFolder(
    #str(new_id),str(title))
    # No - the standard folder's UI is more useful for small wikis,
    # and more importantly BTreeFolder2 isn't standard until 2.8.0b2
    f = Folder()
    f.id, f.title = str(new_id), str(title)
    new_id = parent._setObject(f.id, f)
    f = parent[new_id]
    # add objects from wiki template
    # cataloging really slows this down!
    dir = os.path.join(package_home(globals()),'wikis',wiki_type)
    filenames = os.listdir(dir)
    for filename in filenames:
        if re.match(r'(?:\..*|CVS|_darcs)', filename): continue
        m = re.search(r'(.+)\.(.+)',filename)
        id, type = filename, ''
        if m: id, type = m.groups()
        text = open(dir + os.sep + filename, 'r').read()
        if type == 'dtml':
            addDTMLMethod(f, filename[:-5], title='', file=text)
        elif re.match(r'(?:(?:stx|html|latex)(?:dtml)?|txt)', type):
            addZWikiPage(f,id,title='',page_type=type,file=text)
        elif type == 'pt':
            f._setObject(id, ZopePageTemplate(id, text, 'text/html'))
        elif type == 'py':
            f._setObject(id, PythonScript(id))
            f._getOb(id).write(text)
        elif type == 'zexp' or type == 'xml':
            connection = self.getPhysicalRoot()._p_jar
            f._setObject(id, connection.importFile(dir + os.sep + filename, 
                customImporters=customImporters))
            #self._getOb(id).manage_changeOwnershipType(explicit=0)
        elif re.match(r'(?:jpe?g|gif|png)', type):
            f._setObject(filename, Image(filename, '', text))
        else:
            id = f._setObject(filename, File(filename, '', text))
            if type == 'css': f[filename].content_type = 'text/css'
    f.objectValues(spec='ZWiki Page')[0].updatecontents()
开发者ID:eaudeweb,项目名称:EionetProducts,代码行数:48,代码来源:__init__.py

示例2: _initPAS

# 需要导入模块: from OFS.Folder import Folder [as 别名]
# 或者: from OFS.Folder.Folder import _getOb [as 别名]
    def _initPAS(self, plugin_type_info=(), plugins={}):
        from OFS.Folder import Folder
        from Products.PluggableAuthService.PluggableAuthService import addPluggableAuthService

        app = Folder()
        app.getPhysicalPath = lambda: ()
        app.getPhysicalRoot = lambda: app

        addPluggableAuthService(app)
        pas = app._getOb("acl_users")

        return app, pas
开发者ID:plone,项目名称:Products.PluggableAuthService,代码行数:14,代码来源:test_exportimport.py

示例3: _initRegistry

# 需要导入模块: from OFS.Folder import Folder [as 别名]
# 或者: from OFS.Folder.Folder import _getOb [as 别名]
        def _initRegistry(self, plugin_type_info=(), plugins={}):
            from OFS.Folder import Folder
            from OFS.SimpleItem import SimpleItem
            from Products.PluginRegistry.PluginRegistry import PluginRegistry

            app = Folder()
            app.getPhysicalPath = lambda: ()
            app.getPhysicalRoot = lambda: app

            app._setObject('foo_plugin_1', SimpleItem())
            app._setObject('foo_plugin_2', SimpleItem())

            registry = PluginRegistry(plugin_type_info)
            registry._plugins = {} # it is usually lazy

            for plugin_type, registered in plugins.items():
                for obj_id in registered:
                    obj = app._getOb(obj_id)
                    directlyProvides(obj, plugin_type)
                registry._plugins[plugin_type] = registered

            app._setObject('plugin_registry', registry)
            registry = app._getOb('plugin_registry')
            return app, registry
开发者ID:Vinsurya,项目名称:Plone,代码行数:26,代码来源:test_exportimport.py


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