コード例 #1
0
ファイル: interfaces.py プロジェクト: py361/Zope
class IItem(IZopeObject, IManageable,
            ICopySource, ITraversable, IOwned):

    __name__ = BytesLine(title=u"Name")

    title = BytesLine(title=u"Title")

    def getId():
        """Return the id of the object as a string.

        This method should be used in preference to accessing an id
        attribute of an object directly. The getId method is public.
        """

    def title_or_id():
        """Return the title if it is not blank and the id otherwise.
        """

    def title_and_id():
        """Return the title if it is not blank and the id otherwise.

        If the title is not blank, then the id is included in parens.
        """

    def manage_editedDialog(REQUEST, **args):
        """Show an 'edited' dialog.
        """

    def raise_standardErrorMessage(client=None, REQUEST={},
                                   error_type=None, error_value=None, tb=None,
                                   error_tb=None, error_message='',
                                   tagSearch=None, error_log_url=''):
        """Raise standard error message.
コード例 #2
0
ファイル: zopeconfigure.py プロジェクト: WeAreHus/StudyRecord
class IZopeConfigure(Interface):
    """The ``zope:configure`` Directive

    The zope configuration directive is a pure grouping directive.  It
    doesn't compute any actions on it's own. Instead, it allows a package to
    be specified, affecting the interpretation of relative dotted names and
    file paths. It also allows an i18n domain to be specified.  The
    information collected is used by subdirectives.

    It may seem that this directive can only be used once per file, but it can
    be applied whereever it is convenient. 
    """

    package = GlobalObject(
        title=u("Package"),
        description=u("The package to be used for evaluating relative imports "
                      "and file names."),
        required=False)

    i18n_domain = BytesLine(
        title=u("Internationalization domain"),
        description=u("This is a name for the software project. It must be a "
                      "legal file-system name as it will be used to contruct "
                      "names for directories containing translation data. "
                      "\n"
                      "The domain defines a namespace for the message ids "
                      "used by a project."),
        required=False)
コード例 #3
0
ファイル: zcml.py プロジェクト: mleist/ict-ok.org
class IAdmUtilObjTransportDirective(IMailerDirective):
    """Registers a new pseude mailer."""

    hostname = BytesLine(title=u"Hostname",
                         description=u"Hostname of the SMTP host.",
                         default="localhost",
                         required=False)
コード例 #4
0
class IFile(IAttributeAnnotatable):
    """File object interface"""

    content_type = BytesLine(title="Content type",
                             description="The content type identifies the type of content data",
                             required=False,
                             default=b'',
                             missing_value=b'')

    data = Bytes(title="Content data",
                 description="Actual file content",
                 required=False,
                 default=b'',
                 missing_value=b'')

    def get_size(self):
        """Returns the byte-size of object's data"""

    def get_blob(self, mode='r'):
        """Get Blob file associated with this object"""

    def add_blob_reference(self, reference):
        """Add a reference to file internal blob"""

    def free_blob(self):
        """Free blob associated with this object"""
コード例 #5
0
class TitleSchema(Interface):
    """define the ``title`` property (required for ``PropertyManager`` subclasses).

  Note: this is defined as ``BytesLine``. Therefore, non ASCII values
  will likely not work reliable.
  """

    title = BytesLine(title='title', default='')
コード例 #6
0
class IInclude(Interface):

    file = BytesLine(
        title=u'Configuration file name',
        description=u'Name of a configuration file to be included for each '
        u'installed Product. If the file does not exist, for a '
        u'particular product, no error is raised.',
        required=False)
コード例 #7
0
ファイル: interfaces.py プロジェクト: tseaver/Zope-RFA
class IZopeObject(Interface):

    isPrincipiaFolderish = Bool(
        title=u"Is a folderish object",
        description=u"Should be false for simple items",
    )

    meta_type = BytesLine(
        title=u"Meta type",
        description=u"The object's Zope2 meta type",
    )
コード例 #8
0
class IFavoriteSchema(Interface):

    title = TextLine(
        title=_(u'Title'),
        description=_(u'Title'),
        readonly=True)

    remote_url = BytesLine(
        title=_(u'URL'),
        description=_(u'URL relative to the site root.'),
        required=False,
        missing_value=u'')
コード例 #9
0
ファイル: interfaces.py プロジェクト: bendavis78/zope
class IItem(IZopeObject, IManageable, IFTPAccess, IDAVResource, ICopySource,
            ITraversable, IOwned, IUndoSupport):

    __name__ = BytesLine(title=u"Name")

    title = BytesLine(title=u"Title")

    icon = BytesLine(
        title=u"Icon",
        description=u"Name of icon, relative to SOFTWARE_URL",
    )

    def getId():
        """Return the id of the object as a string.

        This method should be used in preference to accessing an id
        attribute of an object directly. The getId method is public.
        """

    def _setId(id):
        """Set the id"""

    def title_or_id():
        """Returns the title if it is not blank and the id otherwise."""

    def title_and_id():
        """Returns the title if it is not blank and the id otherwise.  If the
        title is not blank, then the id is included in parens."""

    def raise_standardErrorMessage(client=None,
                                   REQUEST={},
                                   error_type=None,
                                   error_value=None,
                                   tb=None,
                                   error_tb=None,
                                   error_message='',
                                   tagSearch=None,
                                   error_log_url=''):
        """Raise standard error message"""
コード例 #10
0
class ILinkSchema(Interface):

    title = TextLine(title=_(u'Title'), required=False, missing_value=u'')

    language = TextLine(title=_(u'Language'),
                        required=False,
                        missing_value=u'',
                        max_length=2)

    description = Text(title=_(u'Description'),
                       required=False,
                       missing_value=u'')

    remote_url = BytesLine(title=_(u'URL'), required=False, missing_value=u'')
コード例 #11
0
ファイル: favorite.py プロジェクト: bendavis78/zope
class IFavoriteSchema(Interface):

    title = TextLine(title=_(u'Title'), required=False, missing_value=u'')

    language = TextLine(title=_(u'Language'),
                        required=False,
                        missing_value=u'',
                        max_length=2)

    description = Text(title=_(u'Description'),
                       required=False,
                       missing_value=u'')

    remote_url = BytesLine(title=_(u'URL'),
                           description=_(u'URL relative to the site root.'),
                           required=False,
                           missing_value=u'')
コード例 #12
0
class IFile(Interface):

    contentType = BytesLine(
        title=_(u'Content Type'),
        description=_(u'The content type identifies the type of data.'),
        default='',
        required=False,
        missing_value='')

    data = Bytes(
        title=_(u'Data'),
        description=_(u'The actual content of the object.'),
        default='',
        missing_value='',
        required=False,
    )

    def getSize():
        """Return the byte-size of the data of the object."""
コード例 #13
0
ファイル: nested.py プロジェクト: WeAreHus/StudyRecord
class IFieldInfo(Interface):

    name = BytesLine(title=u("The field name"), )

    title = TextLine(
        title=u("Title"),
        description=u("A short summary or label"),
        default=u(""),
        required=False,
    )

    required = Bool(title=u("Required"),
                    description=u("Determines whether a value is required."),
                    default=True)

    readonly = Bool(title=u("Read Only"),
                    description=u("Can the value be modified?"),
                    required=False,
                    default=False)
コード例 #14
0
class IIncludePluginsDirective(Interface):
    """Auto-include any ZCML in the dependencies of this package."""

    package = GlobalObject(
        title=u"Package to auto-include for",
        description=u"""
        Auto-include all plugins to this package.
        """,
        required=True,
    )

    file = BytesLine(
        title=u"ZCML filename to look for",
        description=u"""
        Name of a particular ZCML file to look for.
        If omitted, autoinclude will scan for standard filenames
        (e.g. meta.zcml, configure.zcml, overrides.zcml)
        """,
        required=False,
    )
コード例 #15
0
ファイル: zcml.py プロジェクト: MatthewWilkes/repoze.sendmail
class ISMTPMailerDirective(IMailerDirective):
    """Registers a new SMTP mailer."""

    hostname = BytesLine(title=u"Hostname",
                         description=u"Hostname of the SMTP host.",
                         default="localhost",
                         required=False)

    port = Int(title=u"Port",
               description=u"Port of the SMTP server.",
               default=25,
               required=False)

    username = TextLine(title=u"Username",
                        description=u"A username for SMTP AUTH.",
                        required=False)

    password = TextLine(title=u"Password",
                        description=u"A password for SMTP AUTH.",
                        required=False)
コード例 #16
0
ファイル: directives.py プロジェクト: WeAreHus/StudyRecord
class ISimple(Interface):

    a = Text()
    b = Text(required=False)
    c = BytesLine()
コード例 #17
0
ファイル: directives.py プロジェクト: WeAreHus/StudyRecord
class Ik(Interface):
    for_ = BytesLine()
    class_ = BytesLine()
    x = BytesLine()
コード例 #18
0
class ITingIndexSchema(IAttributeIndex):
    default_fields = BytesLine(
        title=_(u"Default fields"),
        description=_(
            "Look in these fields by default (consider dedicated_storage=True)"
        ),
        required=True,
        default='')
    storage = Choice(
        title=_(u"Storage"),
        description=_(u"Component for storing wordID-to-documentID-mappings"),
        required=True,
        default=config.DEFAULT_STORAGE,
        vocabulary="TextIndexNG3 Storages")
    dedicated_storage = Bool(
        title=_(u"Dedicated storage"),
        description=_(
            u"Use seperate index for each field (allows per field search)"),
        required=True,
        default=config.defaults['dedicated_storage'])
    languages = BytesLine(
        title=_(u"Languages"),
        description=_(
            u"Languages supported by this index (space seperated list)"),
        default=config.DEFAULT_LANGUAGE,
        constraint=re.compile('[a-z]+(\s+[a-z]+)*').match)
    use_stemmer = Bool(
        title=_(u"Stemming"),
        description=
        _(u"Compare words according to their word stems (a kind of similarity search)"
          ),
        default=False,
        required=config.defaults['use_stemmer'])
    use_stopwords = Bool(
        title=_(u"Stopwords"),
        description=
        _(u"Enable to prvent looking for words like 'and' or 'a' which are unlike to be useful in search queries"
          ),
        required=True,
        default=config.defaults['use_stopwords'])
    use_normalizer = Bool(
        title=_(u"Normalize"),
        description=
        _(u"Enable to normalize words language specific (e.g. ä -> ae , è -> e)"
          ),
        required=True,
        default=config.defaults['use_normalizer'])
    ranking = Bool(
        title=_(u"Ranking"),
        description=
        _(u"Enable ranking according to word frequency of documents (selects different storage)"
          ),
        required=True,
        default=config.defaults['ranking'])
    autoexpand_limit = Int(
        title=_(u"Autoexpand limit"),
        description=_(u"Lower limit for automatic right-*-wildcard-search"),
        required=True,
        default=config.defaults['autoexpand_limit'])
    splitter = Choice(
        title=_(u"Splitter"),
        description=_(u"Splitter to be used to turn text into words"),
        required=True,
        default=config.DEFAULT_SPLITTER,
        vocabulary="TextIndexNG3 Splitters")
    lexicon = Choice(
        title=_(u"Lexicon"),
        description=_(u"Component to be used for storing word-to-id-mappings"),
        required=True,
        default=config.DEFAULT_LEXICON,
        vocabulary="TextIndexNG3 Lexicons")
    index_unknown_languages = Bool(
        title=_(u"Index unknown languages"),
        description=
        _(u"Assigns unknown languages the first language of the languages selected for this index"
          ),
        required=True,
        default=config.defaults['index_unknown_languages'],
    )
    splitter_additional_chars = BytesLine(
        title=_(u"Non-seperators"),
        description=_(
            u"Characters that should *not* be threaded as separators"),
        required=True,
        default=config.defaults['splitter_additional_chars'])
    splitter_casefolding = Bool(
        title=_(u"Case-insensitive"),
        description=_(u"Make this index case insensitive"),
        required=True,
        default=config.defaults['splitter_casefolding'])
    query_parser = Choice(title=_(u"Query Parser"),
                          description=_(u"Parser to be used for this index"),
                          required=True,
                          default=config.DEFAULT_PARSER,
                          vocabulary="TextIndexNG3 Query Parsers")
コード例 #19
0
ファイル: interfaces.py プロジェクト: Py-AMS/pyams-table
class ITable(IContentProvider):
    # pylint: disable=too-many-public-methods
    """Table provider"""

    column_counter = Int(title="Column counter",
                         description="Column counter",
                         default=0)

    column_index_by_id = Attribute("Dict of column index number by id")

    column_by_name = Attribute("Dict of columns by name")

    columns = Attribute("Sequence of columns")

    rows = Attribute("Sequence of rows")

    selected_items = Attribute("Sequence of selected items")

    # customize this part if needed
    prefix = BytesLine(title="Prefix",
                       description="The prefix of the table used to uniquely identify it.",
                       default=b"table")

    # css classes
    css_classes = Attribute("Dict of element name and CSS classes")

    # additional (row) css
    css_class_even = TextLine(title="Even css row class",
                              description="CSS class for even rows.",
                              default=u"even",
                              required=False)

    css_class_odd = TextLine(title="Odd css row class",
                             description="CSS class for odd rows.",
                             default=u"odd",
                             required=False)

    css_class_selected = TextLine(title="Selected css row class",
                                  description="CSS class for selected rows.",
                                  default=u"selected",
                                  required=False)

    # sort attributes
    sort_on = Int(title="Sort on table index",
                  description="Sort on table index",
                  default=0)

    sort_order = TextLine(title="Sort order",
                          description="Row sort order",
                          default="ascending")

    reverse_sort_order_names = List(title="Selected css row class",
                                    description="CSS class for selected rows.",
                                    value_type=TextLine(title="Reverse sort order name",
                                                        description="Reverse sort order name"),
                                    default=["descending", "reverse", "down"],
                                    required=False)

    # batch attributes
    batch_start = Int(title="Batch start index",
                      description="Index the batch starts with",
                      default=0)

    batch_size = Int(title="Batch size",
                     description="The batch size",
                     default=50)

    start_batching_at = Int(title="Batch start size",
                            description="The minimal size the batch starts to get used",
                            default=50)

    values = Attribute("Iterable table row data sequence.")

    def get_css_class(self, element, css_class=None):
        """Return the css class if any or an empty string."""

    def setup_columns(self):
        """Setup table column renderer."""

    def update_columns(self):
        """Update columns."""

    def init_columns(self):
        """Initialize columns definitions used by the table"""

    def order_columns(self):
        """Order columns."""

    def setup_row(self, item):
        """Setup table row."""

    def setup_rows(self):
        """Setup table rows."""

    def get_sort_on(self):
        """Return sort on column id."""

    def get_sort_order(self):
        """Return sort order criteria."""

    def sort_rows(self):
        """Sort rows."""

    def get_batch_size(self):
        """Return the batch size."""

    def get_batch_start(self):
        """Return the batch start index."""

    def batch_rows(self):
        """Batch rows."""

    def is_selected_row(self, row):
        """Return `True for selected row."""

    def render_table(self):
        """Render the table."""

    def render_head(self):
        """Render the thead."""

    def render_head_row(self):
        """Render the table header rows."""

    def render_head_cell(self, column):
        """Setup the table header rows."""

    def render_body(self):
        """Render the table body."""

    def render_rows(self):
        """Render the table body rows."""

    def render_row(self, row, css_class=None):
        """Render a single table row."""

    def render_json_row(self, row):
        """Render a single table row content in JSON"""

    def render_cell(self, item, column, colspan=0):
        """Render a single table body cell."""

    def render_json_cell(self, item, column):
        """Render a single table body cell content in JSON"""

    def render(self):  # pylint:disable=arguments-differ
        """Plain render method without keyword arguments."""
コード例 #20
0
ファイル: link.py プロジェクト: bendavis78/zope
class ILinkSchema(Interface):

    title = TextLine(title=_(u'Title'), description=_(u'Title'), readonly=True)

    remote_url = BytesLine(title=_(u'URL'), required=False, missing_value=u'')
コード例 #21
0
ファイル: interfaces.py プロジェクト: tseaver/Zope-RFA
class IPropertyManager(Interface):
    """
    The PropertyManager mixin class provides an object with
    transparent property management. An object which wants to
    have properties should inherit from PropertyManager.

    An object may specify that it has one or more predefined
    properties, by specifying an _properties structure in its
    class::

      _properties=({'id':'title', 'type': 'string', 'mode': 'w'},
                   {'id':'color', 'type': 'string', 'mode': 'w'},
                   )

    The _properties structure is a sequence of dictionaries, where
    each dictionary represents a predefined property. Note that if a
    predefined property is defined in the _properties structure, you
    must provide an attribute with that name in your class or instance
    that contains the default value of the predefined property.

    Each entry in the _properties structure must have at least an 'id'
    and a 'type' key. The 'id' key contains the name of the property,
    and the 'type' key contains a string representing the object's type.
    The 'type' string must be one of the values: 'float', 'int', 'long',
    'string', 'lines', 'text', 'date', 'tokens', 'selection', or
    'multiple section'.

    For 'selection' and 'multiple selection' properties, there is an
    addition item in the property dictionay, 'select_variable' which
    provides the name of a property or method which returns a list of
    strings from which the selection(s) can be chosen.

    Each entry in the _properties structure may *optionally* provide a
    'mode' key, which specifies the mutability of the property. The 'mode'
    string, if present, must contain 0 or more characters from the set
    'w','d'.

    A 'w' present in the mode string indicates that the value of the
    property may be changed by the user. A 'd' indicates that the user
    can delete the property. An empty mode string indicates that the
    property and its value may be shown in property listings, but that
    it is read-only and may not be deleted.

    Entries in the _properties structure which do not have a 'mode' key
    are assumed to have the mode 'wd' (writeable and deleteable).

    To fully support property management, including the system-provided
    tabs and user interfaces for working with properties, an object which
    inherits from PropertyManager should include the following entry in
    its manage_options structure::

      {'label':'Properties', 'action':'manage_propertiesForm',}

    to ensure that a 'Properties' tab is displayed in its management
    interface. Objects that inherit from PropertyManager should also
    include the following entry in its __ac_permissions__ structure::

      ('Manage properties', ('manage_addProperty',
                             'manage_editProperties',
                             'manage_delProperties',
                             'manage_changeProperties',)),
    """

    manage_propertiesForm = Attribute(""" """)
    manage_propertyTypeForm = Attribute(""" """)

    title = BytesLine(title=u"Title")

    _properties = Tuple(title=u"Properties", )

    propertysheets = Attribute(""" """)

    def valid_property_id(id):
        """
        """

    def hasProperty(id):
        """Return true if object has a property 'id'.
        """

    def getProperty(id, d=None):
        """Get the property 'id'.

        Returns the optional second argument or None if no such property is
        found.
        """

    def getPropertyType(id):
        """Get the type of property 'id'.

        Returns None if no such property exists.
        """

    def _wrapperCheck(object):
        """Raise an error if an object is wrapped.
        """

    def _setPropValue(id, value):
        """
        """

    def _delPropValue(id):
        """
        """

    def _setProperty(id, value, type='string'):
        """Set property.

        For selection and multiple selection properties the value argument
        indicates the select variable of the property.
        """

    def _updateProperty(id, value):
        """Update the value of an existing property.

        If value is a string, an attempt will be made to convert the value to
        the type of the existing property.
        """

    def _delProperty(id):
        """
        """

    def propertyIds():
        """Return a list of property ids.
        """

    def propertyValues():
        """Return a list of actual property objects.
        """

    def propertyItems():
        """Return a list of (id,property) tuples.
        """

    def _propertyMap():
        """Return a tuple of mappings, giving meta-data for properties.
        """

    def propertyMap():
        """Return a tuple of mappings, giving meta-data for properties.

        Return copies of the real definitions for security.
        """

    def propertyLabel(id):
        """Return a label for the given property id
        """

    def propdict():
        """
        """

    # Web interface

    def manage_addProperty(id, value, type, REQUEST=None):
        """Add a new property via the web.

        Sets a new property with the given id, type, and value.
        """

    def manage_editProperties(REQUEST):
        """Edit object properties via the web.

        The purpose of this method is to change all property values,
        even those not listed in REQUEST; otherwise checkboxes that
        get turned off will be ignored.  Use manage_changeProperties()
        instead for most situations.
        """

    def manage_changeProperties(REQUEST=None, **kw):
        """Change existing object properties.

        Change object properties by passing either a REQUEST object or
        name=value parameters
        """

    def manage_changePropertyTypes(old_ids, props, REQUEST=None):
        """Replace one set of properties with another

        Delete all properties that have ids in old_ids, then add a
        property for each item in props.  Each item has a new_id,
        new_value, and new_type.  The type of new_value should match
        new_type.
        """

    def manage_delProperties(ids=None, REQUEST=None):
        """Delete one or more properties specified by 'ids'."""
コード例 #22
0
class IConfigurationContext(Interface):
    """Configuration Context

    The configuration context manages information about the state of
    the configuration system, such as the package containing the
    configuration file. More importantly, it provides methods for
    importing objects and opening files relative to the package.
    """

    package = BytesLine(
        title=u("The current package name"),
        description=u("""\
          This is the name of the package containing the configuration
          file being executed. If the configuration file was not
          included by package, then this is None.
          """),
        required=False,
        )

    def resolve(dottedname):
        """Resolve a dotted name to an object

        A dotted name is constructed by concatenating a dotted module
        name with a global name within the module using a dot.  For
        example, the object named "spam" in the foo.bar module has a
        dotted name of foo.bar.spam.  If the current package is a
        prefix of a dotted name, then the package name can be relaced
        with a leading dot, So, for example, if the configuration file
        is in the foo package, then the dotted name foo.bar.spam can
        be shortened to .bar.spam.

        If the current package is multiple levels deep, multiple
        leading dots can be used to refer to higher-level modules.
        For example, if the current package is x.y.z, the dotted
        object name ..foo refers to x.y.foo.
        """

    def path(filename):
        """Compute a full file name for the given file

        If the filename is relative to the package, then the returned
        name will include the package path, otherwise, the original
        file name is returned.
        """

    def checkDuplicate(filename):
        """Check for duplicate imports of the same file.

        Raises an exception if this file had been processed before.  This
        is better than an unlimited number of conflict errors.
        """

    def processFile(filename):
        """Check whether a file needs to be processed.

        Return True if processing is needed and False otherwise.  If
        the file needs to be processed, it will be marked as
        processed, assuming that the caller will procces the file if
        it needs to be procssed.
        """

    def action(discriminator, callable, args=(), kw={}, order=0,
               includepath=None, info=None):
        """Record a configuration action

        The job of most directives is to compute actions for later
        processing.  The action method is used to record those
        actions.  The discriminator is used to to find actions that
        conflict. Actions conflict if they have the same
        discriminator. The exception to this is the special case of
        the discriminator with the value None. An actions with a
        discriminator of None never conflicts with other actions. This
        is possible to add an order argument to crudely control the
        order of execution.  'info' is optional source line information,
        'includepath' is None (the default) or a tuple of include paths for
        this action.
        """

    def provideFeature(name):
        """Record that a named feature is available in this context."""

    def hasFeature(name):
        """Check whether a named feature is available in this context."""