Пример #1
0
class IContentTypeDirective(Interface):

    portal_type = configuration_fields.MessageID(title=_('Portal type'),
                                                 description='',
                                                 required=True)

    class_ = configuration_fields.GlobalObject(title=_('Class'),
                                               description='',
                                               required=False)

    schema = configuration_fields.GlobalInterface(title='',
                                                  description='',
                                                  required=True)

    behaviors = configuration_fields.Tokens(
        title='',
        description='',
        value_type=configuration_fields.GlobalInterface(),
        required=False)

    allowed_types = configuration_fields.Tokens(
        title='',
        description='',
        value_type=configuration_fields.MessageID(),
        required=False)

    add_permission = configuration_fields.MessageID(
        title=_('Add permission'), default=DEFAULT_ADD_PERMISSION)
Пример #2
0
class IBehaviorDirective(Interface):
    """Directive which registers a new behavior type.

    The registration consists of:

        * a global named utility registered by interface identifier
        * a global named utility registered by lookup name
        * an associated global and unnamed behavior adapter
    """

    name = TextLine(title=u'Name',
                    description=u'Convenience lookup name for this behavior',
                    required=False)

    title = configuration_fields.MessageID(
        title=u'Title',
        description=u'A user friendly title for this behavior',
        required=True)

    description = configuration_fields.MessageID(
        title=u'Description',
        description=u'A longer description for this behavior',
        required=False)

    provides = configuration_fields.GlobalInterface(
        title=u'An interface to which the behavior can be adapted',
        description=u'This is what the conditional adapter factory will '
        u'be registered as providing',
        required=True)

    marker = configuration_fields.GlobalInterface(
        title=u'A marker interface to be applied by the behavior',
        description=u'If factory is not given, then this is optional',
        required=False)

    factory = configuration_fields.GlobalObject(
        title=u'The factory for this behavior',
        description=u'If this is not given, the behavior is assumed to '
        u'provide a marker interface',
        required=False)

    for_ = configuration_fields.GlobalObject(
        title=u'The type of object to register the conditional adapter '
        u'factory for',
        description=u'This is optional - the default is to register the '
        u'factory for zope.interface.Interface',
        required=False)

    name_only = configuration_fields.Bool(
        title=u'Do not register the behavior under the dotted path, but '
        u'only under the given name',
        description=u'Use this option to register a behavior for the same '
        u'provides under a different name.',
        required=False)
Пример #3
0
class IBehaviorDirective(Interface):
    """Directive which registers a new behavior type.

    The registration consists of:

        * a global named utility registered by interface identifier
        * a global named utility registered by lookup name
        * an associated global and unnamed behavior adapter
    """

    name = TextLine(title=u"Name",
                    description=u"Convenience lookup name for this behavior",
                    required=False)

    title = configuration_fields.MessageID(
        title=u"Title",
        description=u"A user friendly title for this behavior",
        required=True)

    description = configuration_fields.MessageID(
        title=u"Description",
        description=u"A longer description for this behavior",
        required=False)

    provides = configuration_fields.GlobalInterface(
        title=u"An interface to which the behavior can be adapted",
        description=u"This is what the conditional adapter factory will "
        u"be registered as providing",
        required=True)

    marker = configuration_fields.GlobalInterface(
        title=u"A marker interface to be applied by the behavior",
        description=u"If factory is not given, then this is optional",
        required=False)

    factory = configuration_fields.GlobalObject(
        title=u"The factory for this behavior",
        description=u"If this is not given, the behavior is assumed to "
        u"provide a marker interface",
        required=False)

    for_ = configuration_fields.GlobalObject(
        title=u"The type of object to register the conditional adapter "
        u"factory for",
        description=u"This is optional - the default is to register the "
        u"factory for zope.interface.Interface",
        required=False)
Пример #4
0
class IRuleElementDirective(Interface):
    """Directive which registers a new rule element.

    The actual directives will use IRuleActionDirective or IRuleConditionDirective
    """

    name = schema.TextLine(title=u"Name",
                           description=u"A unique name for the element",
                           required=True)

    title = schema.TextLine(
        title=u"Title",
        description=u"A user-friendly title for the element",
        required=True)

    description = schema.Text(
        title=u"Description",
        description=u"A helpful description of the element",
        required=False)

    for_ = configuration_fields.GlobalInterface(
        title=u"Available for",
        description=u"The interface this element is available for",
        required=False)

    event = configuration_fields.GlobalInterface(
        title=u"Event",
        description=u"The event this element is available for",
        required=False)

    addview = schema.TextLine(title=u"Add view",
                              description=u"Name of the add view",
                              required=True)

    editview = schema.TextLine(title=u"Edit view",
                               description=u"Name of the edit view",
                               required=False)

    schema = configuration_fields.GlobalInterface(
        title=u"Schema",
        description=u"The schema interface for configuring the element",
        required=False)

    factory = configuration_fields.GlobalObject(
        title=u"Factory",
        description=u"A callable which can create the element",
        required=False)
Пример #5
0
class IPortletTemplatesDirective(Interface):
    """Directive which registers a directory with templates for the given
    portlet type."""

    directory = fields.Path(title=u"Path to directory", required=True)

    interface = fields.GlobalInterface(
        title=_(u"Portlet type interface"),
        description=_(u"Should correspond to the public interface "
                      u"of the portlet assignment"),
        required=True)
Пример #6
0
class IPortletDirective(Interface):
    """Directive which registers a new portlet type.

    The portlet should also be installed into a site using a GenericSetup
    portlets.xml file, for example.
    """

    name = schema.TextLine(
        title=_(u"Name"),
        description=_(u"A unique name for the portlet. Also used for its add view."),
        required=True)

    interface = configuration_fields.GlobalInterface(
        title=_(u"Assignment type interface"),
        description=_(u"Should correspond to the public interface of the assignment"),
        required=True)

    assignment = configuration_fields.GlobalObject(
        title=_(u"Assignment class"),
        description=_(u"A persistent class storing the portlet assignment"),
        required=True)

    view_permission = schema.TextLine(
        title=_(u"View permission"),
        description=_(u"Permission used for viewing the portlet."),
        required=False,
        default=u"zope2.View"
        )

    edit_permission = schema.TextLine(
        title=_(u"Edit permission"),
        description=_(u"Permission used for editing the portlet assignment."),
        required=False,
        default=u"plone.app.portlets.ManageOwnPortlets"
        )

    renderer = configuration_fields.GlobalObject(
        title=_(u"Renderer"),
        description=_(u"A class which renders the portlet data provider"),
        required=True
        )

    addview = configuration_fields.GlobalObject(
        title=_(u"Add view"),
        description=_(u"View used to add the assignment object"),
        required=True
        )

    editview = configuration_fields.GlobalObject(
        title=_(u"Edit view"),
        description=_(u"View used to edit the assignment object (if appropriate)"),
        required=False
        )
Пример #7
0
class IWidgetDirective(IPageDirective):
    """ Progress bar widget directive
    """
    for_ = fields.GlobalObject(
        title=u"The interface or class this view is for.",
        required=False
        )

    view = fields.GlobalObject(
        title=_(u"View"),
        description=_(u"A class that provides attributes used by the view."),
        required=True,
        )

    edit = fields.GlobalObject(
        title=_(u"Edit"),
        description=_(u"A class that provides attributes used by the edit."),
        required=True,
        )

    name = schema.TextLine(
        title=u"The name of the field from ctype Schema",
        description=_(u""
            u"E.g. prgressbar.widget.title or progressbar.widget.relatedItems"),
        required=False
        )

    layer = fields.GlobalInterface(
        title=_(u"The layer the view is in."),
        description=_(u"""
        A skin is composed of layers. It is common to put skin
        specific views in a layer named after the skin. If the 'layer'
        attribute is not supplied, it defaults to 'default'."""),
        required=False,
        )

    edit_permission = zcml.Permission(
        title=_(u"Edit Permission"),
        description=_(u"The permission needed to edit this widget."),
        required=False,
        )

    view_permission = zcml.Permission(
        title=_(u"View Permission"),
        description=_(u"The permission needed to view this widget."),
        required=False,
        )

    permission = zcml.Permission(
        title=_(u"Permission"),
        description=_(u"The permission needed to use the view or edit"),
        required=False
        )
Пример #8
0
class IBehaviorDirective(Interface):
    """Directive which registers a new behavior type (a global, named
    utility) and associated behavior adapter factory (a global, unnamed
    adapter)
    """

    title = configuration_fields.MessageID(
        title=u"Title",
        description=u"A user friendly title for this behavior",
        required=True)

    description = configuration_fields.MessageID(
        title=u"Description",
        description=u"A longer description for this behavior",
        required=False)

    provides = configuration_fields.GlobalInterface(
        title=u"An interface to which the behavior can be adapted",
        description=u"This is what the conditional adapter factory will "
        u"be registered as providing",
        required=True)

    marker = configuration_fields.GlobalInterface(
        title=u"A marker interface to be applied by the behavior",
        description=u"If provides is given and factory is not given, then "
        u"this is optional",
        required=False)

    factory = configuration_fields.GlobalObject(
        title=u"The factory for this behavior",
        description=u"If this is not given, the behavior is assumed to "
        u"provide a marker interface",
        required=False)

    for_ = configuration_fields.GlobalObject(
        title=u"The type of object to register the conditional adapter "
        u"factory for",
        description=u"This is optional - the default is to register the "
        u"factory for zope.interface.Interface",
        required=False)
Пример #9
0
class IRuleElement(Interface):
    """Base interface for rule elements (actions and conditions)

    A rule element is either a condition or an action that can be combined to
    form a rule.Rules can be constructed by the user and invoked by the
    IRuleExecuter
    """
    title = schema.TextLine(title=u'Title', required=True)

    description = schema.Text(title=u'Description', required=False)

    for_ = configuration_fields.GlobalInterface(
        title=u'Available for',
        description=u'The interface this component is available for',
        required=False)

    event = configuration_fields.GlobalInterface(
        title=u'Applicable event',
        description=u'The event that can trigger this element, None meaning '
        'it is not event specific.',
        required=False)

    addview = schema.TextLine(title=u'Add view',
                              description=u'The name of the add view',
                              required=True)

    editview = schema.TextLine(title=u"Edit view",
                               description=u"The name of the edit view",
                               required=True)

    schema = configuration_fields.GlobalInterface(
        title=u'Schema',
        description=u'Schema interface for configuring the element',
        required=False)

    factory = configuration_fields.GlobalInterface(
        title=u'Factory',
        description=u'Callable which creates an instance of the element',
        required=False)
Пример #10
0
class IPreferenceGroupDirective(Interface):
    """Register a preference group."""

    # The id is not required, since the root group has an empty id.
    id = OptionalDottedName(
        title=u"Id",
        description=u"""
            Id of the preference group used to access the group. The id should
            be a valid path in the preferences tree.""",
        required=False,
        )

    schema = fields.GlobalInterface(
        title=u"Schema",
        description=u"Schema of the preference group used defining the "
                    u"preferences of the group.",
        required=False
        )

    title = fields.MessageID(
        title=u"Title",
        description=u"Title of the preference group used in UIs.",
        required=True
        )

    description = fields.MessageID(
        title=u"Description",
        description=u"Description of the preference group used in UIs.",
        required=False
        )

    category = fields.Bool(
        title=u"Is Group a Category",
        description=u"Denotes whether this preferences group is a category.",
        required=False,
        default=False
        )
Пример #11
0
class ITaskService(IContained):
    """A service for managing and executing tasks."""

    jobs = schema.Object(title=u'Jobs',
                         description=u'A mapping of all jobs by job id.',
                         schema=interface.common.mapping.IMapping)

    taskInterface = fields.GlobalInterface(
        title=u'Task Interface',
        description=u'The interface to lookup task utilities',
        default=ITask,
    )

    def getAvailableTasks():
        """Return a mapping of task name to the task."""

    def add(task, input=None, startLater=False):
        """Add a new job for the specified task.

        * task argument is a string specifying the task.
        * input are arguments for the task.
        * startLater, if True job will be added (gets a jobid) but needs
          to be started with startJob later
        """

    def addCronJob(
            task,
            input,
            minute=(),
            hour=(),
            dayOfMonth=(),
            month=(),
            dayOfWeek=(),
    ):
        """Add a new cron job."""

    def startJob(jobid):
        """Start a job previously added job with add(..., startLater=True)
        """

    def reschedule(jobid):
        """Rescheudle a cron job.

        This is neccessary if the cron jobs parameters are changed.
        """

    def clean(status=[CANCELLED, ERROR, COMPLETED]):
        """removes all jobs which are completed or canceled or have errors."""

    def cancel(jobid):
        """Cancel a particular job."""

    def getStatus(jobid):
        """Get the status of a job."""

    def getResult(jobid):
        """Get the result data structure of the job."""

    def getError(jobid):
        """Get the error of the job."""

    def hasJobsWaiting(now=None):
        """Determine whether there are jobs that need to be processed.

        Returns a simple boolean.
        """

    def processNext():
        """Process the next job in the queue."""

    def process():
        """Process all scheduled jobs.

        This call blocks the thread it is running in.
        """

    def startProcessing():
        """Start processing jobs.

        This method has to be called after every server restart.
        """

    def stopProcessing():
        """Stop processing jobs."""

    def isProcessing():
        """Check whether the jobs are being processed.