from zope.interface import Interface from zope.configuration.fields import GlobalObject from zope.configuration.fields import Path from zope.schema import TextLine from zope.app.component.fields import LayerField from zope.app.security.fields import Permission class IMeldPageDirective(Interface): """ The meldpage directive is used to create views that are accessible as a URL. The meldpage directive creates a new view class from a given template and class and registers it. """ for_ = GlobalObject( title=u"The interface or class this view is for.", required=True ) name = TextLine( title=u"The name of the view.", description=u"""The name which shows up in URLs/paths. For example, 'foo'.""", required=True, ) transform = GlobalObject( title=u"Transform function", description=u"""A callable that accepts an element, a context, and a request. It should mutate the element. The return value is ignored""", required=False, ) package = GlobalObject( title=u"Package", description=u"The package in which the template can be found.", required=False, ) template = Path( title=u"The path of a meld3 template that the page uses.", description=u""" Refers to a file containing a meld3 template.""", required=True ) layer = LayerField( 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 IDefaultBrowserLayer.""", required=False, ) permission = Permission( title=u"Permission", description=u"The permission needed to use the view.", required=True )