Ejemplo n.º 1
0
class IURLDirective(Interface):
    """Say how to compute canonical urls."""

    for_ = GlobalObject(
        title=u"Specification of the object that has this canonical url",
        required=True)

    urldata = GlobalObject(
        title=u"Adapter to ICanonicalUrlData for this object.", required=False)

    path_expression = TextLine(
        title=u"TALES expression that evaluates to the path"
        " relative to the parent object.",
        required=False)

    attribute_to_parent = PythonIdentifier(
        title=u"Name of the attribute that gets you to the parent object",
        required=False)

    parent_utility = GlobalObject(
        title=u"Interface of the utility that is the parent of the object",
        required=False)

    rootsite = PythonIdentifier(
        title=u"Name of the site this URL has as its root."
        "None for 'use the request'.",
        required=False)
Ejemplo n.º 2
0
class ICommonAddInformation(Interface):
    """
    Common information for add forms
    """

    content_factory = GlobalObject(
        title=u"Content factory",
        description=u"""
        An object to call to create new content objects.

        This attribute isn't used if a class is specified that
        implements createAndAdd.""",
        required=False
        )

    content_factory_id = Id(
        title=u"Content factory id",
        description=u"A factory id to create new content objects",
        required = False,
        )

    arguments = Tokens(
        title=u"Arguments",
        description=u"""
        A list of field names to supply as positional arguments to the
        factory.""",
        required=False,
        value_type=PythonIdentifier()
        )

    keyword_arguments = Tokens(
        title=u"Keyword arguments",
        description=u"""
        A list of field names to supply as keyword arguments to the
        factory.""",
        required=False,
        value_type=PythonIdentifier()
        )

    set_before_add = Tokens(
        title=u"Set before add",
        description=u"""
        A list of fields to be assigned to the newly created object
        before it is added.""",
        required=False,
        value_type=PythonIdentifier(),
        )

    set_after_add = Tokens(
        title=u"Set after add",
        description=u"""
        A list of fields to be assigned to the newly created object
        after it is added.""",
        required=False,
        value_type=PythonIdentifier()
        )
Ejemplo n.º 3
0
class IRegisterMultiPlugin(Interface):
    """Register profiles with the global registry.
    """

    class_ = PythonIdentifier(title=u'Class', description=u'', required=False)

    meta_type = PythonIdentifier(
        title=u'Meta-Type',
        description=u"If not specified, 'class/meta_type' is used.",
        required=False)
Ejemplo n.º 4
0
class IRegisterDirectoryDirective(Interface):
    """Register directories with the global registry.
    """

    name = PythonIdentifier(title=u'Name',
                            description=u'Name of the directory.',
                            required=True)

    directory = Path(
        title=u'Path',
        description=u'Path relative to the package. If not specified, '
        u"'skins/<name>' is used.",
        required=False)

    recursive = Bool(
        title=u'Recursive?',
        description=u'False by default. If true, register all subdirectories '
        u'as well.',
        required=False)

    ignore = Tokens(
        title=u'Ignore',
        description=u'Files and subdirectories that should be ignored. If '
        u"not specified, 'CVS' and '.svn' are ignored.",
        value_type=ASCIILine(),
        required=False)
Ejemplo n.º 5
0
class IFieldDescription(Interface):
    """Demographics field."""

    title = TextLine(
        title=_(u"Title"),
        description=_(u"As it should appear on forms and reports."))

    name = PythonIdentifier(
        title=_(u"ID"),
        description=_(u"A unique one word alphanumeric identifier."))

    description = TextLine(
        title=_(u"Description"),
        description=_(u"As it should appear on forms and reports."),
        required=False)

    required = Bool(title=_(u"Required"))

    limit_keys = FilterKeyList(
        title=_(u"Limit to group(s)"),
        description=_(u"If you select one or more groups below, this field "
                      "will only be displayed in forms and reports for "
                      "members of the selected groups."),
        value_type=Choice(
            source="schooltool.basicperson.limit_keys_vocabulary",
            required=True,
        ),
        required=False)
Ejemplo n.º 6
0
class IViewPageSubdirective(Interface):
    """
    Subdirective to IViewDirective.
    """

    name = TextLine(title=u"The name of the page (view)",
                    description=u"""
        The name shows up in URLs/paths. For example 'foo' or
        'foo.html'. This attribute is required unless you use the
        subdirective 'page' to create sub views. If you do not have
        sub pages, it is common to use an extension for the view name
        such as '.html'. If you do have sub pages and you want to
        provide a view name, you shouldn't use extensions.""",
                    required=True)

    attribute = PythonIdentifier(
        title=u"The name of the view attribute implementing the page.",
        description=u"""
        This refers to the attribute (method) on the view that is
        implementing a specific sub page.""",
        required=False)

    template = Path(title=u"The name of a template that implements the page.",
                    description=u"""
        Refers to a file containing a page template (should end in
        extension '.pt' or '.html').""",
                    required=False)
Ejemplo n.º 7
0
class IRegisterConfigDirective(Interface):
    """Register pipeline configurations with the global registry.
    """

    name = PythonIdentifier(title=u'Name',
                            description=u"If not specified 'default' is used.",
                            default=u'default',
                            required=False)

    title = MessageID(
        title=u'Title',
        description=u'Optional title for the pipeline configuration.',
        default=None,
        required=False)

    description = MessageID(
        title=u'Description',
        description=u'Optional description for the pipeline configuration.',
        default=None,
        required=False)

    configuration = Path(
        title=u'Configuration',
        description=u"The pipeline configuration file to register.",
        required=True)
Ejemplo n.º 8
0
class IRegisterProfileDirective(Interface):
    """Register profiles with the global registry.
    """

    name = PythonIdentifier(title=u'Name',
                            description=u"If not specified 'default' is used.",
                            default=u'default',
                            required=False)

    title = MessageID(title=u'Title',
                      description=u'Optional title for the profile.',
                      default=None,
                      required=False)

    description = MessageID(
        title=u'Description',
        description=u'Optional description for the profile.',
        default=None,
        required=False)

    directory = Path(
        title=u'Path',
        description=u"If not specified 'profiles/<name>' is used.",
        required=False)

    provides = GlobalObject(title=u'Type',
                            description=u"If not specified 'BASE' is used.",
                            default=BASE,
                            required=False)

    for_ = GlobalObject(
        title=u'Site Interface',
        description=u'If not specified the profile is always available.',
        default=None,
        required=False)
Ejemplo n.º 9
0
class IRenamedPageDirective(Interface):
    """Schema for the browser:renamed-page directive.

    Use this directive to do redirects instead of the classic way of putting a
    redirect method in a view, hooked in by a browser:page directive.
    """

    for_ = GlobalObject(
        title=u"Specification of the object that has the renamed page",
        required=True)

    layer = GlobalInterface(title=u"The layer the renamed page 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)

    name = zope.schema.TextLine(
        title=u"The name of the old page.",
        description=u"The name shows up in URLs/paths. For example 'foo'.",
        required=True)

    new_name = zope.schema.TextLine(
        title=u"The name the page was renamed to.",
        description=u"The name shows up in URLs/paths. For example 'foo'.",
        required=True)

    rootsite = PythonIdentifier(
        title=u"Name of the site this URL has as its root."
        "None for 'use the request'.",
        required=False)
Ejemplo n.º 10
0
class ICommonFormInformation(ICommonInformation):
    """
    Common information for browser forms
    """

    label = MessageID(
        title=u"Label",
        description=u"A label to be used as the heading for the form.",
        required=False)

    menu = MenuField(title=u"The browser menu to include the form in.",
                     description=u"""
        Many views are included in menus. It's convenient to name the
        menu in the page directive, rather than having to give a
        separate menuItem directive.""",
                     required=False)

    title = MessageID(title=u"Menu title",
                      description=u"The browser menu label for the form.",
                      required=False)

    fields = Tokens(title=u"Fields",
                    description=u"""
        Here you can specify the names of the fields you wish to display. 
        The order in this list is also the order the fields will 
        be displayed in.  If this attribute is not specified, all schema fields
        will be displayed in the order specified in the schema itself.""",
                    required=False,
                    value_type=PythonIdentifier())
Ejemplo n.º 11
0
class ITimeCallDirective(Interface):
    """ZCML directive to apply profiler on fonction
    """

    class_ = GlobalObject(title=u"The class being patched", required=True)
    method = PythonIdentifier(title=u"The method being patched", required=True)
    immediate = Bool(title=u"Profile immediatly",
                    required=False,
                    default=True)
Ejemplo n.º 12
0
class IExportStepDirective(Interface):
    name = PythonIdentifier(title=u'Name', description=u'', required=True)

    title = MessageID(title=u'Title', description=u'', required=True)

    description = MessageID(title=u'Description',
                            description=u'',
                            required=True)

    handler = GlobalObject(title=u'Handler', description=u'', required=True)
Ejemplo n.º 13
0
class IViewletManagerDirective(interface.Interface):
    """
    Creates a new viewlet manager interface in the
    ``nti.nikola_chameleon.viewlets`` package.
    """

    id = PythonIdentifier(
        title=u"The class name of the interface",
        required=True
    )
Ejemplo n.º 14
0
class IFragmentDirectoryDirective(Interface):

    directory = TextLine(title=u'Directory path',
                         description=u'Path relative to the package.',
                         required=True)

    name = PythonIdentifier(
        title=u'Name',
        description=u'Name of the directory. If not specified, the name of '
        u'the current package is used.',
        required=True,
    )
Ejemplo n.º 15
0
class IGlueDirective(Interface):
    """ZCML glue to register some classes perform an action.

    For each class in the classes list, found in the specified module, the
    handler will hookup the class to do something.  Since this is a fairly
    generic mechanism, what that 'something' is isn't important.
    """
    module = GlobalObject(title=u"Module in which the classes are found.")

    classes = Tokens(value_type=PythonIdentifier(),
                     title=u"Space separated list of classes to register.",
                     required=True)
Ejemplo n.º 16
0
class IRuleset(Interface):
    for_ = GlobalObject(
        title=u"Object to be configured",
        description=u"The object for which the cache ruleset is to be defined",
        default=None,
        required=True)

    ruleset = PythonIdentifier(
        title=u"ruleset",
        description=u"The id of the cache ruleset to use",
        default=None,
        required=True)
class IBridgeDirective(Interface):
    """Bridge from a Zope 2 interface to an equivalent Zope3 interface.
    """
    zope2 = GlobalObject(title=u"Zope2", required=True)

    package = GlobalObject(title=u"Target package", required=True)

    name = PythonIdentifier(
        title=u"Zope3 Interface name",
        description=u"If not supplied, the new interface will have the same "
        u"name as the source interface.",
        required=False)
Ejemplo n.º 18
0
class IImportStepDirective(Interface):
    """Register import steps with the global registry.
    """

    name = PythonIdentifier(title=u'Name', description=u'', required=True)

    title = MessageID(title=u'Title', description=u'', required=True)

    description = MessageID(title=u'Description',
                            description=u'',
                            required=True)

    handler = GlobalObject(title=u'Handler', description=u'', required=True)
Ejemplo n.º 19
0
class ITypeWithFSSDirective(Interface):
    """Schema for fss:typeWithFSS directive"""

    class_ = GlobalObject(
        title=u'Class',
        description=u'Dotted name of class of AT based content type using FSS',
        required=True)

    fields = Tokens(
        title=u'Fields',
        description=u'Field name or space(s) separated field names',
        value_type=PythonIdentifier(),
        required=True)
Ejemplo n.º 20
0
class IRegisterProfileDirective(Interface):

    """Register profiles with the global registry.
    """

    name = PythonIdentifier(
        title=u'Name',
        description=u"If not specified 'default' is used.",
        default=u'default',
        required=False)

    title = MessageID(
        title=u'Title',
        description=u'Optional title for the profile.',
        default=None,
        required=False)

    description = MessageID(
        title=u'Description',
        description=u'Optional description for the profile.',
        default=None,
        required=False)

    directory = Path(
        title=u'Path',
        description=u"If not specified 'profiles/<name>' is used.",
        required=False)

    provides = GlobalObject(
        title=u'Type',
        description=u"If not specified 'BASE' is used.",
        default=BASE,
        required=False)

    for_ = GlobalObject(
        title=u'Site Interface',
        description=u'If not specified the profile is always available.',
        default=None,
        required=False)

    pre_handler = GlobalObject(
        title=u'Pre handler',
        description=(u'Function called before applying all steps. '
                     'It gets passed the setup tool as context.'),
        required=False)

    post_handler = GlobalObject(
        title=u'Post handler',
        description=(u'Function called after applying all steps. '
                     'It gets passed the setup tool as context.'),
        required=False)
Ejemplo n.º 21
0
class IBasicViewInformation(Interface):
    """This is the basic information for all views."""

    for_ = Tokens(
        title=_("Specifications of the objects to be viewed"),
        description=_("""This should be a list of interfaces or classes
        """),
        required=True,
        value_type=GlobalObject(
          missing_value=object(),
          ),
        )

    permission = Permission(
        title=_("Permission"),
        description=_("The permission needed to use the view."),
        required=False,
        )

    class_ = GlobalObject(
        title=_("Class"),
        description=_("A class that provides attributes used by the view."),
        required=False,
        )

    allowed_interface = Tokens(
        title=_("Interface that is also allowed if user has permission."),
        description=_("""
        By default, 'permission' only applies to viewing the view and
        any possible sub views. By specifying this attribute, you can
        make the permission also apply to everything described in the
        supplied interface.

        Multiple interfaces can be provided, separated by
        whitespace."""),
        required=False,
        value_type=GlobalInterface(),
        )

    allowed_attributes = Tokens(
        title=_("View attributes that are also allowed if the user"
                " has permission."),
        description=_("""
        By default, 'permission' only applies to viewing the view and
        any possible sub views. By specifying 'allowed_attributes',
        you can make the permission also apply to the extra attributes
        on the view object."""),
        required=False,
        value_type=PythonIdentifier(),
        )
Ejemplo n.º 22
0
class IResourceDirective(IBasicComponentInformation,
                         IBasicResourceInformation):
    """Register a resource"""

    allowed_interface = Tokens(
        title=_("Interface that is also allowed if user has permission."),
        required=False,
        value_type=GlobalInterface(),
    )

    allowed_attributes = Tokens(
        title=_("View attributes that are also allowed if user"
                " has permission."),
        required=False,
        value_type=PythonIdentifier(),
    )
Ejemplo n.º 23
0
class IRequire(Interface):
    """Require a permission to access selected module attributes

    The given permission is required to access any names provided
    directly in the attributes attribute or any names defined by
    interfaces listed in the interface attribute.
    """

    attributes = Tokens(
        title=u"Attributes",
        description=u"The attributes to require permission for.",
        value_type=PythonIdentifier(),
        required=False)

    permission = Permission(
        title=u"Permission ID",
        description=u"The ID of the permission to require.")
Ejemplo n.º 24
0
class IBaseAnonymousObjectFactoryDirective(interface.Interface):
    """
    The common parts of anonymous object factory directives.

    .. versionadded:: 1.0a3
    """

    for_ = GlobalInterface(
        title=
        u"The interface that is the *parent* object this will be used for",
        required=True,
    )

    field = PythonIdentifier(
        title=u'The name of the schema field',
        description=u'The factory results will be assigned to this field.',
        required=True,
    )
Ejemplo n.º 25
0
class IAllow(Interface):
    """Allow access to selected module attributes

    Access is unconditionally allowed to any names provided directly
    in the attributes attribute or to any names defined by
    interfaces listed in the interface attribute.
    """

    attributes = Tokens(title=u"Attributes",
                        description=u"The attributes to provide access to.",
                        value_type=PythonIdentifier(),
                        required=False)

    interface = Tokens(
        title=u"Interface",
        description=(u"Interfaces whos names to provide access to. Access "
                     u"will be provided to all of the names defined by the "
                     u"interface(s). Multiple interfaces can be supplied."),
        value_type=GlobalInterface(),
        required=False)
Ejemplo n.º 26
0
class IClassObjectFactoryDirective(interface.Interface):
    """
    Defines the ``ext:classObjectFactory`` directive.

    This directive registers a single
    :class:`nti.externalization.interfaces.IClassObjectFactory`.

    The factory will be registered for a class object.
    """

    factory = GlobalObject(
        title=u'The class object that will be created.',
        description=
        u"This must define the ``__external_can_create__`` attribute to be true.",
        required=True)

    name = PythonIdentifier(
        title=u"The name for the factory.",
        description=
        (u"If not given, the ``__external_class_name__`` of the class will be used. "
         u"If that's not available, the ``__name__`` will be used."),
        required=False,
    )

    trusted = Bool(
        title=
        u"Ignore any value for ``__external_can_create__`` on the factory.",
        required=False,
        default=False,
    )

    title = MessageID(
        title=u"Title",
        description=u"Provides a title for the object.",
        required=False,
    )

    description = MessageID(
        title=u"Description",
        description=u"Provides a description for the object.",
        required=False)
Ejemplo n.º 27
0
class IResourceDirectoryDirective(Interface):
    """Register resource directories with the global registry.
    """

    directory = TextLine(title=u'Directory path',
                         description=u'Path relative to the package.',
                         required=True)

    name = PythonIdentifier(
        title=u'Name',
        description=u'Name of the directory. If not specified, the name of '
        u'the current package is used.',
        required=False,
    )

    type = ASCIILine(
        title=u'Resource type',
        # XXX use a Choice field + vocab
        #        vocabulary = 'plone.resource.vocab.ResourceTypes',
        required=False,
    )
Ejemplo n.º 28
0
class IComponentDirective(interface.Interface):
    """Register a component to be used by articles
    """

    name = PythonIdentifier(
        title=u'Name',
        description=u"",
        required=True)

    component = GlobalObject(
        title=u'Component',
        description=u'',
        required=True)

    viewlet = GlobalObject(
        title=u'Viewlet',
        description=u'',
        required=True)

    manager = GlobalObject(
        title=u'Viewlet manager',
        description=u'',
        required=True)

    selection = GlobalObject(
        title=u'ComponentSelection',
        description=u'For which object this component may be selected.',
        default=None,
        required=False)

    image = Path(
        title=u'Image',
        description=u"If not specified the one set in the component is registered.",
        required=False)

    permission = Permission(
        title=u"Permission",
        description=u"The permission needed to view the viewlet.",
        default='zope.Public',
        required=True)
Ejemplo n.º 29
0
class IAccessControlSetting(Interface):
    """An access control customisation setting."""

    key = PythonIdentifier(description=u"""A key that identified the setting.
                           For example: 'members_manage_groups',
                           'teachers_edit_person_info'
                           """)
    default = schema.Bool(title=u"The default value for the setting.")
    text = schema.TextLine(
        title=u"Description of the setting for the user interface.")
    alt_text = schema.TextLine(
        title=u"Description of the effect when the setting is off.")

    def getValue():
        """Return the value of the setting.

        Return the default if it is not set in the
        AccessControlCusomisations storage.
        """

    def setValue(value):
        """Set the value of the setting."""
Ejemplo n.º 30
0
class IMonkeyPatchDirective(Interface):
    """ZCML directive to apply a monkey patch late in the configuration cycle.
    This version replaces one object with another.
    """

    class_ = GlobalObject(title=u"The class being patched", required=False)
    module = GlobalObject(title=u"The module being patched", required=False)
    handler = GlobalObject(
        title=u"A function to perform the patching.",
        description=
        u"Must take three parameters: class/module, original (string), and replacement",
        required=False)
    original = PythonIdentifier(title=u"Method or function to replace")
    replacement = GlobalObject(title=u"Method to function to replace with")
    preservedoc = Bool(title=u"Preserve docstrings?",
                       required=False,
                       default=True)
    preserveOriginal = Bool(
        title=
        u'Preserve the original function so that it is reachable view prefix _old_. Only works for def handler.',
        default=False,
        required=False)
    preconditions = Text(
        title=
        u'Preconditions (multiple, separated by space) to be satisified before applying this patch. Example: Products.LinguaPlone<=1.4.3',
        required=False,
        default=u'')
    ignoreOriginal = Bool(
        title=
        u"Ignore if the orginal function isn't present on the class/module being patched",
        default=False)
    docstringWarning = Bool(title=u"Add monkey patch warning in docstring",
                            required=False,
                            default=True)
    description = Text(title=u'Some comments about your monkey patch',
                       required=False,
                       default=u"(No comment)")
    order = Int(title=u"Execution order", required=False, default=1000)