Example #1
0
class IWidgetDirective(Interface):
    """
    Register a widget
    """
    factory = GlobalObject(
        title=_(u"Factory"),
        description=_(u"Python name of a factory which can create the"
                      u" implementation object.  This must identify an"
                      u" object in a module using the full dotted name."),
        required=True,
    )

    schema = GlobalInterface(title=_(u"Schema interface"),
                             description=_(
                                 u"An interface describing schema to be used"
                                 u" within z3c.form"),
                             required=False)

    accessor = GlobalObject(
        title=_(u"Accessor"),
        description=_(u"Accessor to extract data for faceted widget."),
        required=False)

    criterion = GlobalInterface(title=_(u"Criterion interface"),
                                description=_(u"Criterion interface"),
                                required=False)
Example #2
0
class ISkinDirective(Interface):
    """ *BBB: DEPRECATED*

    Creating skins via ZCML has been deprecated.  The 'browser:skin'
    directive will be removed in Zope 3.5.  Skins are now interfaces
    extending 'zope.publisher.interfaces.browser.IBrowserRequest'.
    They are registered using the 'interface' directive.

    **Previous documentation**

    Defines a browser skin

    If you do not specify an `interface`, then one will be automatically
    created for you based on the name using the layers as base interfaces.

    In case you specify an `interface` and a `name`, the skin will be
    available via its dotted name of the interface and the name you specified.

    You cannot specify both, the `interface` and the `layers` attribute.    
    """

    name = TextLine(title=u"Name",
                    description=u"The name of the skin",
                    required=False)

    interface = GlobalInterface(title=u"The skin's interface.", required=False)

    layers = Tokens(title=u"A list of layers",
                    description=u"""
        This should be in order of lookup. Usually one of the layers
        has the same name as the skin, and the last layer should be
        'default', unless you want to completely override all views.
        """,
                    required=False,
                    value_type=GlobalInterface())
Example #3
0
class IBasicResourceInformation(Interface):
    """
    Basic information for resources
    """

    name = TextLine(
        title=_("The name of the resource."),
        description=_("The name shows up in URLs/paths. For example 'foo'."),
        required=True,
        default=_BLANK,
        )

    provides = GlobalInterface(
        title=_("The interface this component provides."),
        description=_("""
        A view can provide an interface.  This would be used for
        views that support other views."""),
        required=False,
        default=Interface,
        )

    type = GlobalInterface(
        title=_("Request type"),
        required=True
        )
Example #4
0
class ILogoDirective(Interface):

    for_ = GlobalInterface(
        title=u'The interface the context should provide.',
        required=False)

    layer = GlobalInterface(
        title=u'The interface the request should provide.',
        required=False)

    base = fields.Path(
        title=u'Relative path to the logo svg file.',
        required=True)

    logo = fields.Path(
        title=u'Relative path to the logo image file.',
        required=False)

    mobile = fields.Path(
        title=u'Relative path to the mobile logo image file.',
        required=False)

    primary_logo_scale = schema.Text(
        title=u'Relative path to the mobile logo image file.',
        required=False)

    height = schema.Text(
        title=u'Relative path to the mobile logo image file.',
        required=False)

    mobile_height = schema.Text(
        title=u'Relative path to the mobile logo image file.',
        required=False)
Example #5
0
class ITileDirective(Interface):
    """Directive which registers a new type of tile
    """

    name = schema.DottedName(
        title=u"Name",
        description=u"A unique, dotted name for the tile",
    )

    title = MessageID(
        title=u"Title",
        description=u"A user friendly title, used when configuring the tile",
        required=False)

    description = MessageID(
        title=u"Description",
        description=u"A longer summary of the tile's purpose and function",
        required=False)

    icon = MessageID(
        title=u"Icon",
        description=u"Image that represents tile purpose and function",
        required=False)

    add_permission = Permission(
        title=u"Add permission",
        description=u"Name of the permission required to instantiate "
        u"this tile",
        required=False,
    )

    schema = GlobalInterface(
        title=u"Configuration schema for the tile",
        description=u"This is used to create standard add/edit forms",
        required=False,
    )

    for_ = GlobalObject(
        title=u"The interface or class this tile is available for",
        required=False,
    )

    layer = GlobalInterface(title=u"The layer the tile is available for",
                            required=False)

    class_ = GlobalObject(title=u"Class",
                          description=u"Class implementing this tile",
                          required=False)

    template = Path(
        title=u"The name of a template that renders this tile",
        description=u"Refers to a file containing a page template",
        required=False,
    )

    permission = Permission(
        title=u"View permission",
        description=u"Name of the permission required to view this item",
        required=False,
    )
Example #6
0
class ITraverser(Interface):
    for_ = GlobalInterface(
        title=u"The interface this traverser is for.",
        required=True,
    )

    type = GlobalInterface(
        title=u"Request type",
        required=True,
    )

    factory = GlobalObject(
        title=u"The pluggable traverser implementation.",
        required=True,
    )

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

    provides = GlobalInterface(
        title=u"Interface the component provides",
        required=False,
    )
class ICommonInformation(Interface):
    """
    Common information for all successive directives
    """

    name = TextLine(
        title=u"Name",
        description=u"The name of the generated view.",
        required=True
        )

    schema = GlobalInterface(
        title=u"Schema",
        description=u"The schema from which the form is generated.",
        required=True
        )

    for_ = GlobalInterface(
        title=u"Interface",
        description=u"""
        The interface this page (view) applies to.

        The view will be for all objects that implement this
        interface. The schema is used if the for attribute is not
        specified.

        If the for attribute is specified, then the objects views must
        implement or be adaptable to the schema.""",
        required=False
        )

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

    layer = GlobalInterface(
        title=u"Layer",
        description=u"The later the view is in. Default: 'default'",
        required=False
        )

    template = Path(
        title=u"Template",
        description=u"An alternate template to use for the form.",
        required=False
        )

    class_ = GlobalObject(
        title=u"Class",
        description=u"""
        A class to provide custom widget definitions or methods to be
        used by a custom template.

        This class is used as a mix-in class. As a result, it needn't
        subclass any special classes, such as BrowserView.""",
        required=False
        )
Example #8
0
class IIconDirective(Interface):

    for_ = GlobalInterface(title=u'The interface the context should provide.',
                           required=False)

    layer = GlobalInterface(title=u'The interface the request should provide.',
                            required=False)

    base = fields.Path(title=u'Relative path to the icon file.', required=True)
class IViewDirective(IPagesDirective):
    """
    The view directive defines a view that has subpages.

    The pages provided by the defined view are accessed by first
    traversing to the view name and then traversing to the page name.
    """

    for_ = GlobalInterface(
        title=u"The interface this view is for.",
        required=False
        )

    name = TextLine(
        title=u"The name of the view.",
        description=u"The name shows up in URLs/paths. For example 'foo'.",
        required=False,
        default=u'',
        )

    menu = MenuField(
        title=u"The browser menu to include the page (view) 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.  'zmi_views' is the menu most often
          used in the Zope management interface.
          
          This attribute will only work if zope.browsermenu is installed.
          """,
        required=False
        )

    title = MessageID(
        title=u"The browser menu label for the page (view)",
        description=u"""
          This attribute must be supplied if a menu attribute is
          supplied.

          This attribute will only work if zope.browsermenu is installed.
          """,
        required=False
        )

    provides = GlobalInterface(
        title=u"The interface this view provides.",
        description=u"""
        A view can provide an interface.  This would be used for
        views that support other views.""",
        required=False,
        default=Interface,
        )
Example #10
0
class IAddSCSSDirective(Interface):

    path = Path(title=u'Path to the .scss file', required=True)

    for_ = GlobalInterface(title=u'The interface the context should provide.',
                           required=False)

    layer = GlobalInterface(title=u'The interface the request should provide.',
                            required=False)

    before = TextLine(title=u'The name of an already added file.',
                      description=u'The name usually consists of'
                      ' "package:relative file path"',
                      required=False)
Example #11
0
class IRemoveSCSSDirective(Interface):

    name = TextLine(title=u'The name of the file to remove.',
                    description=u'The name usually consists of'
                    ' "package:relative file path"',
                    required=True)

    for_ = GlobalInterface(title=u'Remove the file only when the context'
                           ' provides this interface.',
                           required=False)

    layer = GlobalInterface(title=u'Remove the file only when the request'
                            ' provides this interface.',
                            required=False)
Example #12
0
class IPanelDirective(Interface):
    name = schema.TextLine(
        title=_("Name"),
        required=True
    )

    title = schema.TextLine(
        title=_("Title"),
        required=True
    )

    description = schema.TextLine(
        title=_("Description"),
        required=True
    )

    template = Path(
        title=_("Template"),
        required=True
    )

    layer = GlobalInterface(
        title=_("Layer"),
        required=True,
        default=IDefaultBrowserLayer,
    )
Example #13
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)
Example #14
0
class IContainerViews(Interface):
    """Define several container views for an `IContainer` implementation."""

    for_ = GlobalObject(title=u"The declaration this containerViews are for.",
                        description=u"""
        The containerViews will be available for all objects that
        provide this declaration.
        """,
                        required=True)

    contents = Permission(title=u"The permission needed for content page.",
                          required=False)

    index = Permission(title=u"The permission needed for index page.",
                       required=False)

    add = Permission(title=u"The permission needed for add page.",
                     required=False)

    layer = GlobalInterface(
        title=_("The layer the view is in."),
        description=_("""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)
Example #15
0
class IContentDirective(Interface):
    factory = GlobalObject(title=u"The factory that will create the content.",
                           required=True)

    type = GlobalInterface(
        title=u"The type (an interface) that will be created by the factory",
        required=True)
Example #16
0
class IDefaultViewDirective(Interface):
    """
    The name of the view that should be the default.

    This name refers to view that should be the
    view used by default (if no view name is supplied
    explicitly).
    """

    name = TextLine(
        title=_u("The name of the view that should be the default."),
        description=_u("""
        This name refers to view that should be the view used by
        default (if no view name is supplied explicitly)."""),
        required=True)

    for_ = GlobalObject(
        title=_u("The interface this view is the default for."),
        description=_u("""Specifies the interface for which the view is
        registered. All objects implementing this interface can make use of
        this view. If this attribute is not specified, the view is available
        for all objects."""),
        required=False)

    layer = GlobalInterface(
        title=_u("The layer the default view is declared for"),
        description=_u("The default layer for which the default view is "
                       "applicable. By default it is applied to all layers."),
        required=False)
Example #17
0
class IUtilityDirective(Interface):
    """Register a utility."""

    component = GlobalObject(
        title=_u("Component to use"),
        description=(_u("Python name of the implementation object.  This"
                        " must identify an object in a module using the"
                        " full dotted name.  If specified, the"
                        " ``factory`` field must be left blank.")),
        required=False,
    )

    factory = GlobalObject(
        title=_u("Factory"),
        description=(_u("Python name of a factory which can create the"
                        " implementation object.  This must identify an"
                        " object in a module using the full dotted name."
                        " If specified, the ``component`` field must"
                        " be left blank.")),
        required=False,
    )

    provides = GlobalInterface(
        title=_u("Provided interface"),
        description=_u("Interface provided by the utility."),
        required=False,
    )

    name = TextLine(
        title=_u("Name"),
        description=(_u("Name of the registration.  This is used by"
                        " application code when locating a utility.")),
        required=False,
    )
Example #18
0
class ICarouselDirective(Interface):
    """
    A ZCML directive for register a banner or pager template for Carousel.
    """

    name = TextLine(
        title="The name of the banner or pager",
        description="The name shows up in URLs/paths. For example 'foo'.",
        required=True,
    )

    template = Path(
        title="The name of a template that implements the banner or pager",
        description="Refers to a file containing a page template (should end in"
        "extension '.pt' or '.html').",
        required=True)

    title = MessageID(title="The browser menu label for the banner or pager",
                      required=True)

    layer = GlobalInterface(
        title="The layer the banner or pager is declared for",
        description="The default layer for which the banner or pager is "
        "applicable. By default it is applied to all layers.",
        required=False)
Example #19
0
class ISubscriberDirective(Interface):
    """
    Register a subscriber
    """

    factory = GlobalObject(
        title=u('Subscriber factory'),
        description=u('A factory used to create the subscriber instance.'),
        required=False,
    )

    handler = GlobalObject(
        title=u('Handler'),
        description=u('A callable object that handles events.'),
        required=False,
    )

    provides = GlobalInterface(
        title=u('Interface the component provides'),
        description=u('This attribute specifies the interface the adapter '
                      'instance must provide.'),
        required=False,
    )

    for_ = Tokens(
        title=u('Interfaces or classes that this subscriber depends on'),
        description=u('This should be a list of interfaces or classes'),
        required=False,
        value_type=GlobalObject(missing_value=object(), ),
    )
Example #20
0
class IUtilityDirective(Interface):
    """Register a utility."""

    component = GlobalObject(
        title=u('Component to use'),
        description=(u('Python name of the implementation object.  This '
                       'must identify an object in a module using the '
                       'full dotted name.  If specified, the '
                       '``factory`` field must be left blank.')),
        required=False,
    )

    factory = GlobalObject(
        title=u('Factory'),
        description=(u('Python name of a factory which can create the '
                       'implementation object.  This must identify an '
                       'object in a module using the full dotted name. '
                       'If specified, the ``component`` field must '
                       'be left blank.')),
        required=False,
    )

    provides = GlobalInterface(
        title=u('Provided interface'),
        description=u('Interface provided by the utility.'),
        required=False,
    )

    name = TextLine(
        title=u('Name'),
        description=(u('Name of the registration.  This is used by '
                       'application code when locating a utility.')),
        required=False,
    )
Example #21
0
class IAdapterDirective(Interface):
    """
    Register an adapter
    """

    factory = Tokens(title=u('Adapter factory/factories'),
                     description=(u(
                         'A list of factories (usually just one) that create '
                         'the adapter instance.')),
                     required=True,
                     value_type=GlobalObject())

    provides = GlobalInterface(
        title=u('Interface the component provides'),
        description=(u('This attribute specifies the interface the adapter '
                       'instance must provide.')),
        required=False,
    )

    for_ = Tokens(
        title=u('Specifications to be adapted'),
        description=u('This should be a list of interfaces or classes'),
        required=False,
        value_type=GlobalObject(missing_value=object(), ),
    )

    name = TextLine(
        title=u('Name'),
        description=(u('Adapters can have names.\n\n'
                       'This attribute allows you to specify the name for '
                       'this adapter.')),
        required=False,
    )
class IMenuItemsDirective(Interface):
    """
    Define a group of browser menu items

    This directive is useful when many menu items are defined for the
    same interface and menu.
    """

    menu = MenuField(
        title=u"Menu name",
        description=u"The (name of the) menu the items are defined for",
        required=True,
    )

    for_ = GlobalObject(
        title=u"Interface",
        description=u"The interface the menu items are defined for",
        required=True)

    layer = GlobalInterface(
        title=u"Layer",
        description=u"The Layer for which the item is declared.",
        required=False)

    permission = Permission(title=u"The permission needed access the item",
                            description=u"""
        This can usually be inferred by the system, however, doing so
        may be expensive. When displaying a menu, the system tries to
        traverse to the URLs given in each action to determine whether
        the url is accessible to the current user. This can be
        avoided if the permission is given explicitly.""",
                            required=False)
Example #23
0
class IIconDirective(Interface):
    """
    Define an icon for an interface
    """

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

    for_ = GlobalInterface(title=u"The interface this icon is for.",
                           description=u"""
        The icon will be for all objects that implement this
        interface.""",
                           required=True)

    file = Path(title=u"File",
                description=u"The file containing the icon.",
                required=False)

    resource = TextLine(title=u"Resource",
                        description=u"A resource containing the icon.",
                        required=False)

    title = MessageID(title=u"Title",
                      description=u"Descriptive title",
                      required=False)

    layer = GlobalInterface(title=u"The layer the icon should be found in",
                            description=u"""
        For information on layers, see the documentation for the skin
        directive. Defaults to "default".""",
                            required=False)

    width = Int(title=u"The width of the icon.",
                description=u"""
        The width will be used for the <img width="..." />
        attribute. Defaults to 16.""",
                required=False,
                default=16)

    height = Int(title=u"The height of the icon.",
                 description=u"""
        The height will be used for the <img height="..." />
        attribute. Defaults to 16.""",
                 required=False,
                 default=16)
Example #24
0
class IBrowserLayerAwareExtender(Interface):
    """An plone browserlayer aware schemaextender.

    Extenders with this interface are used only in context of the given
    browserlayer.
    """

    layer = GlobalInterface()
Example #25
0
class IService(Interface):
    """ """

    method = TextLine(
        title=u"The name of the view that should be the default. " +
        u"[get|post|put|delete]",
        description=u"""
        This name refers to view that should be the view used by
        default (if no view name is supplied explicitly).""",
    )

    accept = TextLine(
        title=u"Acceptable media types",
        description=u"""Specifies the media type used for content negotiation.
        The service is limited to the given media type and only called if the
        request contains an "Accept" header with the given media type. Multiple
        media types can be given by separating them with a comma.""",
        default=u"application/json",
    )

    for_ = GlobalObject(
        title=u"The interface this view is the default for.",
        description=u"""Specifies the interface for which the view is
        registered. All objects implementing this interface can make use of
        this view. If this attribute is not specified, the view is available
        for all objects.""",
    )

    factory = GlobalObject(
        title=u"The factory for this service",
        description=u"The factory is usually subclass of the Service class.",
    )

    name = TextLine(
        title=u"The name of the service.",
        description=u"""When no name is defined, the service is available at
        the object's absolute URL. When defining a name, the service is
        available at the object's absolute URL appended with a slash and the
        service name.""",
        required=False,
        default=u"",
    )

    layer = GlobalInterface(
        title=u"The browser layer for which this service is registered.",
        description=u"""Useful for overriding existing services or for making
                        services available only if a specific add-on has been
                        installed.""",
        required=False,
        default=IDefaultBrowserLayer,
    )

    permission = Permission(
        title=u"Permission",
        description=u"The permission needed to access the service.",
        required=True,
    )
Example #26
0
class IInterfaceDirective(Interface):
    """
    Define an interface
    """

    interface = GlobalInterface(
        title=_("Interface"),
        required=True,
    )

    type = GlobalInterface(
        title=_("Interface type"),
        required=False,
    )

    name = TextLine(
        title=_("Name"),
        required=False,
    )
Example #27
0
class ISkinDirectoryDirective(IResourceDirectoryDirective):

    layers = Tokens(title=u"A list of layers",
                    description=u"""
        This should be in order of lookup. Usually one of the layers
        has the same name as the skin, and the last layer should be
        'default', unless you want to completely override all views.
        """,
                    required=False,
                    value_type=GlobalInterface())
class IOnlineHelpTopicDirective(Interface):
    """Register an online topic.

    Optionally you can register a topic for a component and view.
    """

    id = NativeStringLine(
        title=u"Topic Id",
        description=u"Id of the topic as it will appear in the URL.",
        required=True)

    title = MessageID(
        title=u"Title",
        description=u"Provides a title for the online Help Topic.",
        required=True)

    parent = NativeStringLine(title=u"Parent Topic",
                              description=u"Id of the parent topic.",
                              default="",
                              required=False)

    for_ = GlobalInterface(
        title=u"Object Interface",
        description=u"Interface for which this Help Topic is registered.",
        default=None,
        required=False)

    view = NativeStringLine(
        title=u"View Name",
        description=u"The view name for which this Help Topic is registered.",
        default="",
        required=False)

    doc_path = Path(
        title=u"Path to File",
        description=u"Path to the file that contains the Help Topic content.",
        required=True)

    class_ = GlobalObject(
        title=u"Factory",
        description=u"""
        The factory is the topic class used for initializeing the topic""",
        required=False,
    )

    resources = Tokens(title=u"A list of resources.",
                       description=u"""
        A list of resources which shall be used for the Help Topic.
        The resources must be located in the same directory as
        the Help Topic definition.
        """,
                       value_type=TextLine(),
                       required=False)
Example #29
0
class ISkin(Interface):
    """Skin interface

    Skins are registered as utilities implementing this interface
    and defining request layer as attribute.
    """

    label = TextLine(title="Skin name")

    layer = GlobalInterface(
        title="Request layer",
        description="This interface will be used to tag request layer",
        required=True)
Example #30
0
class IListItemDirective(Interface):
    provides = GlobalInterface(
        title=u"Provided interface",
        description=u"Interface provided by the utility.",
        required=True,
    )

    component = GlobalObject(
        title=u"Component to use",
        description=(u"Python name of the implementation object.  This"
                     " must identify an object in a module using the"
                     " full dotted name.  If specified, the"
                     " ``factory`` field must be left blank."),
        required=False,
    )

    factory = GlobalObject(
        title=u"Factory",
        description=(u"Python name of a factory which can create the"
                     " implementation object.  This must identify an"
                     " object in a module using the full dotted name."
                     " If specified, the ``component`` field must"
                     " be left blank."),
        required=False,
    )

    name = TextLine(
        title=u"Name",
        description=(u"Name of the registration.  This is used by"
                     " application code when locating a utility."),
        required=False,
    )

    title = TextLine(
        title=u"Title",
        description=u"Title for the registration.",
        required=False,
    )

    description = TextLine(
        title=u"Description",
        description=u"Description for the registration.",
        required=False,
    )

    sort_key = TextLine(
        title=u"Description",
        description=u"Description for the registration.",
        required=False,
    )