Esempio n. 1
0
 def __init__(self, component):
     docstring = component.__doc__ or ''
     Attribute.__init__(self, docstring)
Esempio n. 2
0
class IPeopleCategoryItem(Interface):
    """Metadata about a person category value."""
    title = Attribute("Descriptive name.  Example: 'Human Resources'")
    description = Attribute("An XHTML block that describes the category value")
Esempio n. 3
0
class IPeopleReportGroup(Interface):
    """A group of reports displayed in a section
    """
    title = Attribute("Report group title")
Esempio n. 4
0
class ICatalogQueryEvent(Interface):
    """Notification that a catalog was queried"""
    catalog = Attribute('The catalog that was queried')
    query = Attribute('Keyword parameters passed in the query')
    duration = Attribute('How long the query took, in seconds')
    result = Attribute('The result of the query: (result_count, [docid])')
Esempio n. 5
0
class IOrderedFolder(IFolder):
    """Orderable container
    """
    order = Attribute("Ordered sequence of IDs")
Esempio n. 6
0
class ICommunityInfo(Interface):
    """ An adapter for obtaining information about a single community """
    name = Attribute('The name of the community')
    title = Attribute('The title of the community')
    description = Attribute('The description of the community')
    tags = Attribute("Tags applied to the community")
    number_of_members = Attribute("Number of members in the community")
    url = Attribute("Community URL")
    last_activity_date = Attribute("Date content was last modified")
    tabs = Attribute("Information on tabs available for the community view")
    community_tags = Attribute("Tags most used in the community")
    member = Attribute("Is the current user a member of the community?")
    moderator = Attribute("Is the current user a moderator of the community?")
Esempio n. 7
0
class IObjectWillBeModifiedEvent(IObjectEvent):
    """ An event type sent before an object is modified  """
    object = Attribute('The object that will be modified')
Esempio n. 8
0
class IRequestMixin(Interface):
    """A request helper mixin.
    
    An implementation of this interface is supposed to be derived from when
    request operations are desired.
    
    The convention is to provide self.context and self.request on the deriving
    object.
    """

    nameprefix = Attribute(u"prefix for param keys")

    checkboxpostfix = Attribute(
        u"postfix for detecting emplty checkbox values")

    def writeFormData(additionals=None,
                      ignores=None,
                      considerexisting=False,
                      considerspecific=None,
                      nameprefix=False,
                      checkboxes=[],
                      writechain=(COOKIE, )):
        """Write data to storages defined in chain.
        
        @param additionals - a dict containing additional request params.
        @param ignores - a list of param names to ignore.
        @param considerexisting - When set to True, this forces to consider all
                                  existing parameters from request.form, but
                                  additionals overrule them anyway.
        @param considerspecific - list of param names to consider specific.
                                  only takes effect if considerexisting is set
                                  to False. this attribute rules ignores.
        @nameprefix - An alternative nameprefix. If explicit set to None,
                      nameprefix is ignored.
        @param checkboxes - list of names representing checkboxes. If set,
                            check for param 'name_checkboxpostfix' as well.
        @param writechain - storage chain to write to.
        """

    def makeUrl(context=None, url=None, resource=None, query=None):
        """Make a URL.
        
        @param context - a context to get the URL from, if not given, 
                         url or self.context.absolute_url() is used.
        @param url - a URL to use, if not given, self.context.absolute_url()
                     is used.
        @param resource - a template, browser resource or similar to append
                          to the url.
        @param query - a query to append to the url.
        @return string - the URL.
        """

    def makeQuery(additionals=None,
                  ignores=None,
                  considerexisting=False,
                  considerspecific=None,
                  nameprefix=False,
                  chain=(REQUEST, )):
        """Make a query string.
        
        @param additionals - a dict containing additional request params.
        @param ignores - a list of param names to ignore.
        @param considerexisting - When set to True, this forces to consider all
                                  existing parameters from request.form, but
                                  additionals overrule them anyway.
        @param considerspecific - list of param names to consider specific.
                                  only takes effect if considerexisting is set
                                  to False. this attribute rules ignores.
        @param nameprefix - An alternative nameprefix. If explicit set to None,
                            nameprefix is ignored.
        @param chain - chain defines the lookup order.
        @return string - the query.
        """

    def formvalue(name, default=None, checkbox=False, nameprefix=False):
        """Return value for name from form or default.
        
        @param name - the name of the requested parameter.
        @param default - default value to return if param by name not exists.
        @param checkbox - Flag defining wether expected value comes from
                          checkbox. If set to True, check for param
                          'name_checkboxpostfix' as well.
        @param nameprefix - An alternative nameprefix. If explicit set to None,
                            nameprefix is ignored.
        @return value - the requested value or default.
        """

    def cookievalue(name, default=None, nameprefix=False):
        """Return value for name from cookie or default.
        
        @param name - the name of the requested parameter.
        @param default - default value to return if param by name not exists.
        @param nameprefix - An alternative nameprefix. If explicit set to None,
                            nameprefix is ignored.
        @return value - the requested value or default.
        """

    def sessionvalue(name, default=None, nameprefix=False):
        """Return value for name from session or default.
        
        @param name - the name of the requested parameter.
        @param default - default value to return if param by name not exists.
        @param nameprefix - An alternative nameprefix. If explicit set to None,
                            nameprefix is ignored.
        @return value - the requested value or default.
        """

    def requestvalue(name,
                     default=None,
                     checkbox=False,
                     chain=(REQUEST, COOKIE),
                     nameprefix=False):
        """Return value for name or default.
        
        Try to read value either from request.form, from cookie or from session,
        order is defined by chain, first one found is returned. If no one is
        found the default value is returned.
        
        @param name - the name of the requested parameter.
        @param default - default value to return if param by name not exists.
        @param checkbox - Flag defining wether expected value comes from
                          checkbox. If set to True, check for param
                          'name_checkboxpostfix' as well.
        @param chain - chain defines the lookup order.
        @param nameprefix - An alternative nameprefix. If explicit set to None,
                            nameprefix is ignored.
        @return value - the requested value or default.
        """

    def xrequestvalue(name,
                      default=None,
                      checkbox=False,
                      chain=(REQUEST, COOKIE),
                      nameprefix=False):
        """Extended requestvalue function.
        
        Return value for name or default.
        
        Try to read value either from request.form, from cookie or from session,
        order is defined by chain, first one found is returned.
        
        Additional, if nothing is found try:
        
          * to lookup named adapter for IRequestDefaultValue by nameprefix on
            self.context.
          * if nameprefix not set, try too lookup IRequestDefaultValue as
            regular adapter.
          * if adapter returned, try to read value by name from
            IRequestDefaultValue implementation
        
        If nothing was found anyway the default value is returned.
        
        @param name - the name of the requested parameter.
        @param default - default value to return if param by name not exists.
        @param checkbox - Flag defining wether expected value comes from
                          checkbox. If set to True, check for param
                          'name_checkboxpostfix' as well.
        @param chain - chain defines the lookup order.
        @param nameprefix - An alternative nameprefix. If explicit set to None,
                            nameprefix is ignored.
        @return value - the requested value or default.
        """

    #@deprecation.deprecate("selected() will be removed in version 2.0.")
    def selected(name, value, cookiewins=False, nameprefix=False):
        """Check wether request contains param by name and if value is value
        of this param.
        
        @param name - the name of the request parameter
        @param value - the value to check against
        @param cookiewins - flag wether to prefer value from cookie
        @param nameprefix - An alternative nameprefix. If explicit set to None,
                            nameprefix is ignored.
        @return bool - wether requested parameter contains value equal to value
        """

    def formselected(name, value, nameprefix=False):
        """Check wether request contains param by name and if value is value
        of this param.
        
        @param name - the name of the requested parameter.
        @param value - the value to check against.
        @param nameprefix - An alternative nameprefix. If explicit set to None,
                            nameprefix is ignored.
        @return bool - wether requested parameter contains value equal to value.
        """

    def cookieselected(name, value, nameprefix=False):
        """Check wether cookie contains param by name and if value is value
        of this param.
        
        @param name - the name of the requestrd parameter.
        @param value - the value to check against.
        @param nameprefix - An alternative nameprefix. If explicit set to None,
                            nameprefix is ignored.
        @return bool - wether requested parameter contains value equal to value.
        """

    def sessionselected(name, value, nameprefix=False):
        """Check wether session contains param by name and if value is value
        of this param.
        
        @param name - the name of the requested parameter.
        @param value - the value to check against.
        @param nameprefix - An alternative nameprefix. If explicit set to None,
                            nameprefix is ignored.
        @return bool - wether requested parameter contains value equal to value.
        """

    def requestselected(name,
                        value,
                        chain=(REQUEST, COOKIE),
                        nameprefix=False):
        """Check for requested param by name and if value is value
        of this param.
        
        Try to read value either from request.form, from cookie or from session,
        order is defined by chain, first one found is used (remaining are
        ignored).
        
        @param name - the name of the requested parameter.
        @param value - the value to check against.
        @param chain - chain defines the lookup order.
        @param nameprefix - An alternative nameprefix. If explicit set to None,
                            nameprefix is ignored.
        @return bool - wether requested parameter contains value equal to value.
        """

    def xrequestselected(name,
                         value,
                         chain=(REQUEST, COOKIE),
                         nameprefix=False):
        """Extended requestselected function.
        
        Check for requested param by name and if value is value of this param.
        
        Try to read value either from request.form, from cookie or from session,
        order is defined by chain, first one found is used (remaining are
        ignored).
        
        Additional, try:
        
          * to lookup named adapter for IRequestDefaultValue by nameprefix on
            self.context.
          * if nameprefix not set, try too lookup IRequestDefaultValue as
            regular adapter.
          * if adapter returned, try to read value by name from
            IRequestDefaultValue implementation
        
        @param name - the name of the requested parameter.
        @param value - the value to check against.
        @param chain - chain defines the lookup order.
        @param nameprefix - An alternative nameprefix. If explicit set to None,
                            nameprefix is ignored.
        @return bool - wether requested parameter contains value equal to value.
        """

    def cookieset(name, value, path='/', nameprefix=False):
        """Set value to cookie by name.
        
        @param name - the name of the param to set.
        @param value - the value to set for param.
        @param path - the path the cookie is valid for.
        @param nameprefix - An alternative nameprefix. If explicit set to None,
                            nameprefix is ignored.
        """

    def sessionset(name, value, nameprefix=False):
        """Set value to session by name.
        
        @param name - the name of the param to set.
        @param value - the value to set for param.
        @param nameprefix - An alternative nameprefix. If explicit set to None,
                            nameprefix is ignored.
        """

    def redirect(url):
        """Redirect to url.
Esempio n. 9
0
class IInvalidationEvent(IObjectEvent):
    """
    ZenHub has noticed an invalidation.
    """
    oid = Attribute("OID of the changed object")
Esempio n. 10
0
class IPended(Interface):
    """A pended event, tied to a token."""

    token = Attribute("""The pended token.""")

    expiration_date = Attribute("""The expiration date of the pended event.""")
Esempio n. 11
0
class IPendedKeyValue(Interface):
    """A pended key/value pair."""

    key = Attribute("""The pended key.""")

    value = Attribute("""The pended value.""")
class IResolveUidsEnabler(Interface):
    available = Attribute(
        "Boolean indicating whether UID links should be resolved.")
class IImageCaptioningEnabler(Interface):
    available = Attribute(
        "Boolean indicating whether image captioning should be performed.")
Esempio n. 14
0
class IReportPublishInfo(Interface):
    name = Attribute("Report name")
    date = Attribute("datetime object of when report was generated")
Esempio n. 15
0
class ITrendReport(IReport):
    """Report on a set of metrics measured in discrete periods over time
    
    period starts are inclusive, while stops are exclusive (for report)
    """
    period = Attribute("Callable implementing ITrendReportPeriod")
Esempio n. 16
0
class IServiceAddedEvent(Interface):
    """
    ZenHub has created a service.
    """
    name = Attribute("Dotted class name of the service")
    instance = Attribute("Collector name")
Esempio n. 17
0
class ICommunityContent(IContent):
    """ Base interface for content which is within a community.
    """
    creator = Attribute(u'Creating userid')
    modified_by = Attribute(u'ID of user who last modified the object')
    title = Attribute(u'Title of content')
Esempio n. 18
0
class IHubCreatedEvent(Interface):
    """
    A hub has been instantiated.
    """
    hub = Attribute("The hub")
Esempio n. 19
0
class ITagQuery(Interface):
    """Centralize policies about listing tag information"""

    tagusers = Attribute("List the taguser information on a resource")
Esempio n. 20
0
class IParserReadyForOptionsEvent(Interface):
    """
    A parser is ready for extra options to be added.
    """
    parser = Attribute("The option parser")
Esempio n. 21
0
class IObjectModifiedEvent(IObjectEvent):
    """ An event type sent after an object is modified """
    object = Attribute('The object which was modified')
Esempio n. 22
0
class ITransitionLogicalGuard(Interface):
    """ Transition logical guard
    """
    available = Attribute("boolean if transitions is available")
Esempio n. 23
0
class IIntranets(ICommunity):
    """ Mark the top of the intranet hierarchy e.g. /osi """
    taggedValue('name', 'Intranets')
    feature = Attribute('HTML for the feature portlet')
Esempio n. 24
0
class ILocalRoleEmails(Interface):
    """ Local role emails
    """
    emails = Attribute("Dictionary with emails for each role")
Esempio n. 25
0
class IPeopleCategories(Interface):
    """ Marker for the 'categories' container under a peopledir.
    """
    title = Attribute("Directory title")
Esempio n. 26
0
class IInvitation(Interface):
    """ Persistent object with information for joining KARL """
    taggedValue('name', 'Invitation')

    email = Attribute(u'Email address for the person being invited')
    message = Attribute(u'Personal message sent along with the invitation')
Esempio n. 27
0
class IPeopleSectionColumn(Interface):
    """A visual column within a section display
    """
    width = Attribute("Width of a section column")
Esempio n. 28
0
class IProfile(IFolder, IPeople):
    """ User profile """
    taggedValue('name', 'Person')
    taggedValue('search_option', True)
    taggedValue('icon', 'user.png')

    firstname = Attribute(u"User's first name.")
    lastname = Attribute(u"User's last name.")
    email = Attribute(u"User's email address.")

    # XXX The fields below (phone through biography) are OSI specific
    # and probably should be removed from here.  It's possible that
    # they don't need to be documented as interface attributes at all.
    phone = Attribute(u"User's phone number.")
    extension = Attribute(u"User's phone extension.")
    fax = Attribute(u"User's fax number.")

    # XXX redundant with categories?
    department = Attribute(u"User's department.")

    position = Attribute(u"User's position.")

    # XXX redundant with categories?
    organization = Attribute(u"User's organization")

    location = Attribute(u"User's location.")
    country = Attribute(u"User's country.")
    websites = Attribute(u"User's websites urls.")
    languages = Attribute(u"User's spoken languages.")

    # XXX redundant with categories?
    office = Attribute(u"User's office.")

    room_no = Attribute(u"User's room number.")
    biography = Attribute(u"User's biography.")

    date_format = Attribute(u"User's preferred date format.")

    home_path = Attribute(u"Path to user's home model, possibly including "
                          u"view.  May be None.")
    categories = Attribute(
        u"A dictionary that maps category key to a list of "
        u"category value identifier strings. "
        u"Example: {'departments': ['finance']}. "
        u"Typical keys: 'entities', 'offices', 'departments', 'other'")

    preferred_communities = Attribute(u"List of preferred communities. May "
                                      u" be None.")

    password_reset_key = Attribute(u"Key for confirming password reset.  "
                                   u"Not for display or editing.")
    password_reset_time = Attribute(
        u"Datetime when password reset was requested.  "
        u"Not for display or editing.")

    def get_alerts_preference(community_name):
        """Returns constant value representing user's alert preference for
        the given community.

        Possible values are:

        o IProfile.ALERT_IMMEDIATELY
        o IProfile.ALERT_DIGEST
        o IProfile.ALERT_NEVER

        """

    def set_alerts_preference(community_name, preference):
        """Sets user's alert preference for the given community.

        Possible values are:

        o IProfile.ALERT_IMMEDIATELY
        o IProfile.ALERT_DIGEST
        o IProfile.ALERT_NEVER

        """

    last_login_time = Attribute(
        u"Datetime when user last logged into the system.  Display-only.")
Esempio n. 29
0
class IPeopleReportFilter(Interface):
    """A filter for a report displayed in a section
    """
    values = Attribute("Category values for which the filter applies")
Esempio n. 30
0
class ICreatedModified(Interface):
    """ Interface indicating content that has its created and modified
    attributes managed by an event subscriber (this implies all IContent
    content at the moment). """
    modified = Attribute(u'Datetime indicating modification')
    created = Attribute(u'Datetime indicating creation')
Esempio n. 31
0
 def __init__(self, type):
     Attribute.__init__(self, None, " ")
     if not isinstance(type, types.TypeType) and not interface.IEntity.providedBy(type):
         raise TypeError("type must be a Type")
     self.type = type
Esempio n. 32
0
class IReportDates(Interface):
    begin = Attribute("Beginning datetime object of report metrics")
    end = Attribute("Ending datetime object of report metrics")