Пример #1
0
 def edit(self, id, enabled=None, condition=None):
     """See IModifierRegistrySet
     """
     modifier = self.get(id)
     if IConditionalTalesModifier.providedBy(modifier):
         modifier.edit(enabled, condition)
     else:
         if condition:
             raise NotImplementedError('%s does not implement conditions.' %
                                       modifier)
         modifier.edit(enabled)
Пример #2
0
 def edit(self, id, enabled=None, condition=None):
     """See IModifierRegistrySet
     """
     modifier = self.get(id)
     if IConditionalTalesModifier.providedBy(modifier):
         modifier.edit(enabled, condition)
     else:
         if condition:
             raise NotImplementedError(
                 '%s does not implement conditions.' % modifier)
         modifier.edit(enabled)
Пример #3
0
def install_modifiers(context, logger):
    portal_modifier = getToolByName(context, 'portal_modifier')
    for m in modifiers:
        id_ = m['id']
        if id_ in portal_modifier.objectIds():
            continue
        title = m['title']
        modifier = m['modifier'](id_, title)
        wrapper = m['wrapper'](id_, modifier, title)
        enabled = m['enabled']
        if IConditionalTalesModifier.providedBy(wrapper):
            wrapper.edit(enabled, m['condition'])
        else:
            wrapper.edit(enabled)
        portal_modifier.register(m['id'], wrapper)
Пример #4
0
def install_modifiers(site):
    portal_modifier = getToolByName(site, 'portal_modifier')
    for m in modifiers:
        id_ = m['id']
        if id_ in portal_modifier.objectIds():
            continue
        title = m['title']
        modifier = m['modifier'](id_, title)
        wrapper = m['wrapper'](id_, modifier, title)
        enabled = m['enabled']
        if IConditionalTalesModifier.providedBy(wrapper):
            wrapper.edit(enabled, m['condition'])
        else:
            wrapper.edit(enabled)
        portal_modifier.register(m['id'], wrapper)
Пример #5
0
def install(portal_modifier):
    """Registers modifiers in the modifier registry (at tool install time).
    """
    for m in modifiers:
        id = m['id']
        if id in portal_modifier.objectIds():
            continue
        title = m['title']
        modifier = m['modifier']()
        wrapper = m['wrapper'](id, modifier, title)
        enabled = m['enabled']
        if IConditionalTalesModifier.providedBy(wrapper):
            wrapper.edit(enabled, m['condition'])
        else:
            wrapper.edit(enabled)

        portal_modifier.register(m['id'], wrapper)
Пример #6
0
def install(portal_modifier):
    """Registers modifiers in the modifier registry (at tool install time).
    """
    for m in modifiers:
        id = m["id"]
        if id in portal_modifier.objectIds():
            continue
        title = m["title"]
        modifier = m["modifier"]()
        wrapper = m["wrapper"](id, modifier, title)
        enabled = m["enabled"]
        if IConditionalTalesModifier.providedBy(wrapper):
            wrapper.edit(enabled, m["condition"])
        else:
            wrapper.edit(enabled)

        portal_modifier.register(m["id"], wrapper)