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


Python BeforeTraverse.registerBeforeTraverse方法代码示例

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


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

示例1: manage_afterAdd

# 需要导入模块: from ZPublisher import BeforeTraverse [as 别名]
# 或者: from ZPublisher.BeforeTraverse import registerBeforeTraverse [as 别名]
    def manage_afterAdd(self, item, container):
        if item is self:
            container.__allow_groups__ = aq_base(self)

            handle = self.meta_type + '/' + self.getId()
            container = container.this()
            nc = BeforeTraverse.NameCaller(self.getId())
            BeforeTraverse.registerBeforeTraverse(container, nc, handle)
开发者ID:goschtl,项目名称:zope,代码行数:10,代码来源:PluggableAuthService.py

示例2: manage_afterAdd

# 需要导入模块: from ZPublisher import BeforeTraverse [as 别名]
# 或者: from ZPublisher.BeforeTraverse import registerBeforeTraverse [as 别名]
    def manage_afterAdd(self, item, container):
        if item is self:
            id = self.id
            if callable(id):
                id = id()

            # We want the original object, not stuff in between
            container = container.this()
            hook = BeforeTraverse.NameCaller(id)
            BeforeTraverse.registerBeforeTraverse(container, hook, self.meta_type, self.priority)
开发者ID:wpjunior,项目名称:proled,代码行数:12,代码来源:SiteRoot.py

示例3: _update

# 需要导入模块: from ZPublisher import BeforeTraverse [as 别名]
# 或者: from ZPublisher.BeforeTraverse import registerBeforeTraverse [as 别名]
 def _update(self, portal):
     traversers = portal.__before_traverse__
     for priority, name in traversers.keys():
         if portal.getId() in name:
             self.log.debug('Fix not needed')
             return
     name_caller = BeforeTraverse.NameCaller(portal.getId())
     app_handle = '%s/%s' % (portal.meta_type, portal.getId())
     BeforeTraverse.registerBeforeTraverse(portal, name_caller, app_handle)
     self.log.debug('Fix applied!')
     return True
开发者ID:eaudeweb,项目名称:naaya.updater,代码行数:13,代码来源:update_fix_login.py

示例4: manage_afterAdd

# 需要导入模块: from ZPublisher import BeforeTraverse [as 别名]
# 或者: from ZPublisher.BeforeTraverse import registerBeforeTraverse [as 别名]
    def manage_afterAdd(self, item, container):
        if item is self:
            if BeforeTraverse.queryBeforeTraverse(container, self.meta_type):
                raise BadRequest, ("This container already has a %s" % self.meta_type)
            id = self.id
            if callable(id):
                id = id()

            # We want the original object, not stuff in between
            container = container.this()
            hook = BeforeTraverse.NameCaller(id)
            BeforeTraverse.registerBeforeTraverse(container, hook, self.meta_type, self.priority)
开发者ID:wpjunior,项目名称:proled,代码行数:14,代码来源:VirtualHostMonster.py

示例5: _edit

# 需要导入模块: from ZPublisher import BeforeTraverse [as 别名]
# 或者: from ZPublisher.BeforeTraverse import registerBeforeTraverse [as 别名]
 def _edit(self, **kw):
   # XXX it is unclear if we should keep this behavior in other potential subclasses.
   # Probably yes.
   if self.getPortalType() in ('Web Section', 'Web Site'):
     if getattr(self, '__before_traverse__', None) is None:
       # migrate beforeTraverse hook if missing
       handle = self.meta_type + '/' + self.getId()
       BeforeTraverse.registerBeforeTraverse(self, self._getTraversalHookClass()(), handle)
     else:
       # cleanup beforeTraverse hooks that may exist after this document was cloned.
       self._cleanupBeforeTraverseHooks()
   super(WebSection, self)._edit(**kw)
开发者ID:ccwalkerjm,项目名称:erp5,代码行数:14,代码来源:WebSection.py

示例6: test_json_request_on_object_with_multihook

# 需要导入模块: from ZPublisher import BeforeTraverse [as 别名]
# 或者: from ZPublisher.BeforeTraverse import registerBeforeTraverse [as 别名]
    def test_json_request_on_object_with_multihook(self):
        doc1 = self.portal[self.portal.invokeFactory('Document', id='doc1')]

        # Register a function to be called before traversal
        def btr_test(container, request):
            request._btr_test_called = 1
        doc1.btr_test = btr_test
        nc = BeforeTraverse.NameCaller('btr_test')
        BeforeTraverse.registerBeforeTraverse(doc1, nc, 'Document/btr_test')

        obj = self.traverse(path='/plone/doc1')
        self.assertTrue(isinstance(obj, Service), 'Not a service')
        self.assertEquals(1, self.request._btr_test_called)
开发者ID:plone,项目名称:plone.rest,代码行数:15,代码来源:test_traversal.py

示例7: test_app_layer_enabled_directly

# 需要导入模块: from ZPublisher import BeforeTraverse [as 别名]
# 或者: from ZPublisher.BeforeTraverse import registerBeforeTraverse [as 别名]
    def test_app_layer_enabled_directly(self):
        folder = api.content.create(container=self.portal,
                                    type='Folder',
                                    title='testfolder')
        api.content.transition(folder, 'publish')
        directlyProvides(folder, IMockFolder)
        folder.app_layers = (IMockLayer,)
        BeforeTraverse.registerBeforeTraverse(folder,
                                              enable_app_layer(),
                                              'enable_app_layer')
        transaction.commit()

        browser = Browser(self.app)
        browser.open("%s/@@browser_layers" % folder.absolute_url())
        self.assertTrue('ploneintranet.layout.tests.utils.IMockLayer'
                        in browser.contents)
开发者ID:smcmahon,项目名称:ploneintranet,代码行数:18,代码来源:test_layers.py

示例8: movedNySite

# 需要导入模块: from ZPublisher import BeforeTraverse [as 别名]
# 或者: from ZPublisher.BeforeTraverse import registerBeforeTraverse [as 别名]
def movedNySite(ob, event):
    """ A NySite was moved """
    if IObjectAddedEvent.providedBy(event):

        #Hadled by addedNySite
        return
    elif IObjectRemovedEvent.providedBy(event):

        #Hadled by removedNySite
        return
    else:
        old_handle = ob.meta_type + '/' + event.oldName
        BeforeTraverse.unregisterBeforeTraverse(ob, old_handle)
        handle = ob.meta_type + '/' + event.newName
        nc = BeforeTraverse.NameCaller(event.newName)
        BeforeTraverse.registerBeforeTraverse(ob, nc, handle)
开发者ID:bogtan,项目名称:Naaya,代码行数:18,代码来源:events.py

示例9: handleCookieCrumblerEvent

# 需要导入模块: from ZPublisher import BeforeTraverse [as 别名]
# 或者: from ZPublisher.BeforeTraverse import registerBeforeTraverse [as 别名]
def handleCookieCrumblerEvent(ob, event):
    """ Event subscriber for (un)registering a CC as a before traverse hook.
    """
    if not ICookieCrumbler.providedBy(ob):
        return

    if IObjectMovedEvent.providedBy(event):
        if event.newParent is not None:
            # register before traverse hook
            handle = ob.meta_type + '/' + ob.getId()
            nc = BeforeTraverse.NameCaller(ob.getId())
            BeforeTraverse.registerBeforeTraverse(event.newParent, nc, handle)
    elif IObjectWillBeMovedEvent.providedBy(event):
        if event.oldParent is not None:
            # unregister before traverse hook
            handle = ob.meta_type + '/' + ob.getId()
            BeforeTraverse.unregisterBeforeTraverse(event.oldParent, handle)
开发者ID:goschtl,项目名称:zope,代码行数:19,代码来源:CookieCrumbler.py

示例10: manage_afterAdd

# 需要导入模块: from ZPublisher import BeforeTraverse [as 别名]
# 或者: from ZPublisher.BeforeTraverse import registerBeforeTraverse [as 别名]
    def manage_afterAdd(self, item, container):
        """ after add event """
        if item is self:
            handle = self.meta_type + '/' + self.getId()
            nc = BeforeTraverse.NameCaller(self.getId())
            BeforeTraverse.registerBeforeTraverse(container, nc, handle)
        self.loadDefaultRoles()
        try:
            self.createRepository()
            style_css = open(join(DOCMANAGER_PRODUCT_PATH,'zpt','DocManager','DocManager_style.zpt'))
            content = style_css.read()
            style_css.close()
            manage_addPageTemplate(self, id=DOCMANAGER_CSS, title='', text=content)

            style_css = open(join(DOCMANAGER_PRODUCT_PATH,'zpt','DocManager','DocManager_template.zpt'))
            content = style_css.read()
            style_css.close()
            manage_addPageTemplate(self, id=DOCMANAGER_TEMPLATE, title='', text=content)

            Folder.inheritedAttribute('manage_afterAdd')(self, item, container)
        except:
            pass
开发者ID:eaudeweb,项目名称:naaya,代码行数:24,代码来源:DocManager.py

示例11: _edit

# 需要导入模块: from ZPublisher import BeforeTraverse [as 别名]
# 或者: from ZPublisher.BeforeTraverse import registerBeforeTraverse [as 别名]
 def _edit(self, **kw):
   # migrate beforeTraverse hook if missing
   if getattr(self, '__before_traverse__', None) is None and self.getPortalType() == 'Web Section':
     handle = self.meta_type + '/' + self.getId()
     BeforeTraverse.registerBeforeTraverse(self, WebSectionTraversalHook(), handle)
   super(WebSection, self)._edit(**kw)
开发者ID:Verde1705,项目名称:erp5,代码行数:8,代码来源:WebSection.py

示例12: manage_afterAdd

# 需要导入模块: from ZPublisher import BeforeTraverse [as 别名]
# 或者: from ZPublisher.BeforeTraverse import registerBeforeTraverse [as 别名]
 def manage_afterAdd(self, item, container):
   if item is self and self.getPortalType() == 'Web Section':
     handle = self.meta_type + '/' + self.getId()
     BeforeTraverse.registerBeforeTraverse(item, WebSectionTraversalHook(), handle)
   super(WebSection, self).manage_afterAdd(item, container)
开发者ID:Verde1705,项目名称:erp5,代码行数:7,代码来源:WebSection.py

示例13: manage_afterAdd

# 需要导入模块: from ZPublisher import BeforeTraverse [as 别名]
# 或者: from ZPublisher.BeforeTraverse import registerBeforeTraverse [as 别名]
 def manage_afterAdd(self, item, container):
   if item is self:
     handle = self.meta_type + '/' + self.getId()
     BeforeTraverse.registerBeforeTraverse(item, WebSiteTraversalHook(), handle)
   WebSection.manage_afterAdd(self, item, container)
开发者ID:bhuvanaurora,项目名称:erp5,代码行数:7,代码来源:WebSite.py

示例14: manage_afterAdd

# 需要导入模块: from ZPublisher import BeforeTraverse [as 别名]
# 或者: from ZPublisher.BeforeTraverse import registerBeforeTraverse [as 别名]
 def manage_afterAdd(self, item, container):
     if item is self:
         handle = self.meta_type + '/' + self.id
         container = container.this()
         nc = BeforeTraverse.NameCaller(self.id)
         BeforeTraverse.registerBeforeTraverse(container, nc, handle)
开发者ID:goschtl,项目名称:zope,代码行数:8,代码来源:CookieCrumbler.py

示例15: manage_afterAdd

# 需要导入模块: from ZPublisher import BeforeTraverse [as 别名]
# 或者: from ZPublisher.BeforeTraverse import registerBeforeTraverse [as 别名]
 def manage_afterAdd(self, item, container):
   if item is self:
     handle = self.meta_type + '/' + self.getId()
     BeforeTraverse.registerBeforeTraverse(item, self._getTraversalHookClass()(), handle)
   super(WebSection, self).manage_afterAdd(item, container)
开发者ID:ccwalkerjm,项目名称:erp5,代码行数:7,代码来源:WebSection.py


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