Back to index

plone3  3.1.7
metaconfigure.py
Go to the documentation of this file.
00001 from zope.component.zcml import utility
00002 from zope.interface import Interface
00003 
00004 from plone.contentrules.rule.interfaces import IRuleCondition, IRuleAction
00005 from plone.contentrules.rule.element import RuleCondition, RuleAction
00006 
00007 def ruleConditionDirective(_context, name, title, addview, editview=None, 
00008         description="", for_=Interface, event=Interface, schema=None, factory=None):
00009     """Register a utility for IRuleCondition based on the parameters in the 
00010     zcml directive
00011     """
00012     
00013     condition = RuleCondition()
00014     condition.title = title
00015     condition.addview = addview
00016     condition.editview = editview
00017     condition.description = description
00018     condition.for_ = for_
00019     condition.event = event
00020     condition.schema = schema
00021     condition.factory = factory
00022     
00023     utility(_context, provides=IRuleCondition, component=condition, name=name)
00024     
00025     
00026 def ruleActionDirective(_context, name, title, addview, editview=None,
00027     description="", for_=Interface, event=Interface, schema=None, factory=None):
00028     """Register a utility for IRuleAction based on the parameters in the 
00029     zcml directive
00030     """
00031     
00032     action = RuleAction()
00033     action.title = title
00034     action.addview = addview
00035     action.editview = editview
00036     action.description = description
00037     action.for_ = for_
00038     action.event = event
00039     action.schema = schema
00040     action.factory = factory
00041     
00042     utility(_context, provides=IRuleAction, component=action, name=name)