class IMetadata(Interface):
    """
    Interface for the metadata supported by content objects in a repository
    """

    title = Attribute('title', 'The title of the object')

    abstract = Attribute('abstract',
                         "A brief description or summary of the content")

    license = Attribute('license', "The content's license URL")

    created = Attribute(
        'created',
        "A DateTime repsentation of when the first version of this content was created"
    )

    revised = Attribute(
        'revised',
        "A DateTime repsentation of when the this version was revised")

    keywords = Attribute('keywords', "A list of keywords or phrases")

    authors = Attribute('authors', "The usernames of this object's authors")

    parentAuthors = Attribute(
        'parentAuthors', "The usernames of the authors of any parent works")

    maintainers = Attribute('maintainers',
                            "The usernames of this object's maintainers")

    licensors = Attribute(
        'licensors',
        "The usernames of this object's licensors (aka copyright holders)")
Пример #2
0
class IDatabaseInitEvent(Interface):
    """Interface for events involved in initializing databases."""

    connections = Attribute("connections", "A mapping of database connections")

    clear_all = Attribute(
        "clear_all", """True to clear the database.

    This attribute is designed for testing purposes.
    """)
Пример #3
0
class IColumnSchema(Interface):
    """A column in a table."""

    name = Attribute("name", "The column name")

    type = Attribute("type",
                     "The type of data held in the column, as a string")

    unique = Attribute("unique",
                       "True if the column is part of the primary key")
Пример #4
0
class IMapperEvent(Interface):
    """The base interface for events occurring in context of a mapper."""

    conf = Attribute("conf", "The IMapperConfiguration")

    mapper = Attribute("mapper", "The IMapper")

    oid = Attribute("oid", "The OID of the object being mapped")

    classification = Attribute("classification",
                               "The classification of the object.")
Пример #5
0
class IMapper(Interface):
    """A hub for mapping a certain kind of object.
    """
    name = Attribute("name", "The name of this mapper")

    class_name = Attribute("class_name",
                           "The class expected by this mapper (may be empty)")

    serializer = Attribute("serializer",
                           "The IObjectSerializer for this mapper")

    gateway = Attribute("gateway", "The IGateway for this mapper")

    initializers = Attribute("initializers", "A list of IDatabaseInitializers")
Пример #6
0
class IMapperConfiguration(Interface):
    """A configuration of mappers.
    """

    mappers = Attribute("mappers", "Maps mapper name to IMapper")

    classifier = Attribute("classifier", "The IClassifier")

    oid_gen = Attribute("oid_gen", "The IOIDGenerator")

    initializers = Attribute("initializers", "A list of IDatabaseInitializers")

    def check():
        """Verifies the configuration is sane.
Пример #7
0
class IClassifier(Interface):
    """Object classifier

    Implementations of this interface are a little like biologists.
    During serialization, the classify_object() method returns a
    mapping containing the classification of subob (like a biologist
    identifying a creature's genus and species).  During
    deserialization, the classify_state() method decides what kind of
    objects to create for a stored state (like a biologist showing you
    a creature of a certain genus and species).

    The keys in classifications are implementation-dependent.
    """

    gateway = Attribute(
        "gateway", """The classification IGateway.

    Classifiers load and store classifications using a gateway.  This
    attribute allows the system to store the classification of an
    object by calling gateway.store().
    """)

    def classify_object(event):
        """Returns a classification with at least a mapper_name.

        event is an ILoadEvent without a mapper or classification
        (since this method chooses them).
        """

    def classify_state(event):
        """Returns a classification with at least a mapper_name.
Пример #8
0
class portal_memberdata(Base):
    '''A helper for portal_membership that transparently adds
    member data to user objects.
    '''
    id = Attribute('id', 'Must be set to "portal_memberdata"')

    ## wrapUser__roles__ = ()  # Private.
    def wrapUser(u):
        '''
        If possible, returns the Member object that corresponds
        to the given User object.
        '''
    ## getMemberDataContents__roles__ = ()  # Private.
    def getMemberDataContents():
        '''
        Returns a list containing a dictionary with information 
        about the _members BTree contents: member_count is the 
        total number of member instances stored in the memberdata-
        tool while orphan_count is the number of member instances 
        that for one reason or another are no longer in the 
        underlying acl_users user folder.
        The result is designed to be iterated over in a dtml-in
        '''

    ## pruneMemberDataContents__roles__ = ()  # Private.
    def pruneMemberDataContents():
        '''
class portal_collaboration(Interface):
    """Defines an interface for a tool that allows people to agree to collaborate"""

    id = Attribute('id', 'Must be set to "portal_collaboration"')

    def searchCollaborations(user=None, requester=None, status=None):
        """Find collaboration requests with the specified parameters"""
Пример #10
0
class portal_catalog(Interface):
    '''This tool interacts with a customized ZCatalog.
    '''
    id = Attribute('id', 'Must be set to "portal_catalog"')

    # searchResults inherits security assertions from ZCatalog.
    def searchResults(REQUEST=None, **kw):
        '''Calls SiteIndex.searchResults() with extra arguments that
        limit the results to what the user is allowed to see.
        '''

    # __call__ inherits security assertions from ZCatalog.
    def __call__(REQUEST=None, **kw):
        '''Same as searchResults().'''

    def indexObject(object):
        """ Add to catalog.

        Permission -- Python only
        """

    def unindexObject(object):
        """ Remove from catalog.

        Permission -- Python only
        """

    def reindexObject(object, idxs=[], update_metadata=1):
        """ Update entry in catalog.
Пример #11
0
class portal_catalog(Base):
    '''This tool interacts with a customized ZCatalog.
    '''
    id = Attribute('id', 'Must be set to "portal_catalog"')

    # searchResults inherits security assertions from ZCatalog.
    def searchResults(REQUEST=None, **kw):
        '''Calls SiteIndex.searchResults() with extra arguments that
        limit the results to what the user is allowed to see.
        '''

    # __call__ inherits security assertions from ZCatalog.
    def __call__(REQUEST=None, **kw):
        '''Same as searchResults().'''

    # indexObject__roles__ = ()  # Called only by Python code.
    def indexObject(object):
        '''Add to catalog.
        '''

    # unindexObject__roles__ = ()
    def unindexObject(object):
        '''Remove from catalog.
        '''

    # reindexObject__roles__ = ()
    def reindexObject(object):
        '''Update entry in catalog.
        '''

    # getpath inherits security assertions from ZCatalog.
    def getpath(data_record_id_):
        '''Calls ZCatalog.getpath().
Пример #12
0
class portal_skins(SkinsContainer):
    """ An object that provides skins to a portal object.
    """
    id = Attribute('id', 'Must be set to "portal_skins"')

    def getSkinSelections():
        """ Get the sorted list of available skin names.
Пример #13
0
class IInputConverter(Interface):
    """Interface for InputConverters.
    
    InputConverters work as filters, they do not store data in itself.
    """

    name = Attribute("Name of the InputConverter.")

    def registration():
        """Tells which DiagramTypes and DataSources this Converter serves.

        Returns: {DiagrammKind1:[DataSource1, DataSource2, ...],
                  DiagrammKind2:[DataSource3, ...]}
          (The names are references to classes!)
        """

    def convert(data, fixColumn):
        """Converts data to SVGrafZ input format.

        data ... data to convert, type depending on converter
        fixColumn ... string or None: column on which are the other values
           depending
        Return:    list fitting to SVGrafZ input format.
        Exception RuntimeError with error-text if an error occured
        """

    def description():
        """Description of the abilities of the InputConverter.
class CollaborationManager(Interface):
    """Interface for managing collaborations"""

    default_roles = Attribute('default_roles', 'Sequence of collaboration roles')

    def requestCollaboration(user, roles):
        """Set the roles for a user, if necessary making a collaboration request"""

    def getPendingCollaborations():
        """Return a mapping of usernames to pending collaboration requests for this object"""

    def getCollaborators():
        """Return the list of usernames who are collaborating on this object"""

    def getCollaborationRoles():
        """Return the sequence of collaboration roles"""

    def editCollaborationRequest(id, roles):
        """Change the roles of the collaboration request having the specified id"""

    def setCollaborationRoles(user, roles):
        """Set the collaboration roles for the specified user (does not affect other Zope roles)"""

    def clearCollaborations():
        """Remove all collaboration roles and cancel requests"""
        
    def deleteCollaborationRequests():
        """Remove all collaboration requests for this object"""
Пример #15
0
class portal_memberdata(Interface):
    '''A helper for portal_membership that transparently adds
    member data to user objects.
    '''
    id = Attribute('id', 'Must be set to "portal_memberdata"')

    ## wrapUser__roles__ = ()  # Private.
    def wrapUser(u):
        '''
        If possible, returns the Member object that corresponds
        to the given User object.
        '''

    ## getMemberDataContents__roles__ = ()  # Private.
    def getMemberDataContents():
        '''
        Returns a list containing a dictionary with information
        about the _members BTree contents: member_count is the
        total number of member instances stored in the memberdata-
        tool while orphan_count is the number of member instances
        that for one reason or another are no longer in the
        underlying acl_users user folder.
        The result is designed to be iterated over in a dtml-in
        '''

    def pruneMemberDataContents():
        """ Delete member data of all members not listet in acl_users.

        Compare the user IDs stored in the member data tool with the list in
        the actual underlying acl_users and delete anything not in acl_users.

        Permission -- Python only
        """

    def searchMemberData(search_param, search_term, attributes=()):
        """ Search members.

        Returns a sequence of dictionaries containing data for members
        that match the query as expressed by search_param and search_term.
        The contents of each member data mapping can be influenced by
        passing in a sequence of desired attributes, by default the only
        data returned is the username and the email address.

        Permission -- Python only

        Returns -- Sequence of dictionaries
        """

    def registerMemberData(m, id):
        """ Add the given member data to the _members btree.

        This is done as late as possible to avoid side effect transactions and
        to reduce the necessary number of entries.

        Permission -- Python only
        """

    def deleteMemberData(member_id):
        """ Delete member data of specified member.
Пример #16
0
class CachingPolicyManager(Interface):
    """
        Manage HTTP cache policies for skin methods.
    """
    id = Attribute( 'id', 'Must be set to "caching_policy_manager"' )

    def getHTTPCachingHeaders( content, view_method, keywords, time=None ):
        """
Пример #17
0
class IOIDGenerator(Interface):
    """A utility for generating OIDs.
    """

    root_oid = Attribute("root_oid", "The OID to use for the root")

    def new_oid(event):
        """Returns a new oid, which should be a string.
Пример #18
0
class portal_registration(Interface):
    '''Establishes policies for member registration. Depends on
    portal_membership. Is not aware of membership storage details.
    '''
    id = Attribute('id', 'Must be set to "portal_registration"')

    #isRegistrationAllowed__roles__ = None  # Anonymous permission
    def isRegistrationAllowed(REQUEST):
        '''Returns a boolean value indicating whether the user
        is allowed to add a member to the portal.
        '''

    #testPasswordValidity__roles__ = None  # Anonymous permission
    def testPasswordValidity(password, confirm=None):
        '''If the password is valid, returns None.  If not, returns
        a string explaining why.
        '''

    #testPropertiesValidity__roles__ = None  # Anonymous permission
    def testPropertiesValidity(new_properties, member=None):
        '''If the properties are valid, returns None.  If not, returns
        a string explaining why.
        '''

    #generatePassword__roles__ = None  # Anonymous permission
    def generatePassword():
        '''Generates a password which is guaranteed to comply
        with the password policy.
        '''

    # permission: 'Add portal member'
    def addMember(id,
                  password,
                  roles=('Member', ),
                  domains='',
                  properties=None):
        '''Creates a PortalMember and returns it. The properties argument
        can be a mapping with additional member properties. Raises an
        exception if the given id already exists, the password does not
        comply with the policy in effect, or the authenticated user is not
        allowed to grant one of the roles listed (where Member is a special
        role that can always be granted); these conditions should be
        detected before the fact so that a cleaner message can be printed.
        '''

    # permission: 'Add portal member'
    def isMemberIdAllowed(id):
        '''Returns 1 if the ID is not in use and is not reserved.
        '''

    #afterAdd__roles__ = ()  # No permission.
    def afterAdd(member, id, password, properties):
        '''Called by portal_registration.addMember()
        after a member has been added successfully.'''

    # permission: 'Mail forgotten password'
    def mailPassword(forgotten_userid, REQUEST):
        '''Email a forgotten password to a member.  Raises an exception
Пример #19
0
class portal_actions(Interface):
    """ Gathers a list of links which the user is allowed to view according to
    the current context.
    """
    id = Attribute('id', 'Must be set to "portal_actions"')

    def listActionProviders():
        """ List the ids of all Action Providers queried by this tool.

        Permission -- Manage portal

        Returns -- Tuple of Action Provider ids
        """

    def addActionProvider(provider_name):
        """ Add an Action Provider id to the providers queried by this tool.

        A provider must implement the ActionProvider Interface.
        OldstyleActionProviders are currently also supported.

        The provider is only added if the actions tool can find the object
        corresponding to the provider_name.

        Permission -- Manage portal
        """

    def deleteActionProvider(provider_name):
        """ Delete an Action Provider id from providers queried by this tool.

        The deletion only takes place if provider_name is actually found among
        the known action providers.

        Permission -- Manage portal
        """

    def listFilteredActionsFor(object=None):
        """ List all actions available to the user.

        Each action has the following keys:

        - name: An identifying action name

        - url: The URL to visit to access the action

        - permissions: A list. The user must have at least one of the listed
          permissions to access the action. If the list is empty, the user is
          allowed. (Note that listFilteredActionsFor() filters out actions
          according to this field.)

        - category: One of "user", "folder", "object", "global" or "workflow"

        Permission -- Always available

        Returns -- Dictionary of category / action list pairs.
        """

    def listFilteredActions(object=None):
        """ Deprecated alias of listFilteredActionsFor.
Пример #20
0
class portal_url(Interface):
    """ CMF URL Tool interface.

    This interface provides a common mechanism for finding the 'root'
    object of a CMFSite, and for computing paths to objects relative to
    that root.
    """
    id = Attribute('id', 'Must be set to "portal_url"')

    def __call__(relative=0, *args, **kw):
        """ Get by default the absolute URL of the portal.

        Permission -- Always available

        Returns -- Slash-separated string
        """

    def getPortalObject():
        """ Get the portal object itself.

        Permission -- Always available

        Returns -- CMFSite object
        """

    def getRelativeContentPath(content):
        """ Get the path for an object, relative to the portal root.

        Permission -- Always available

        Returns -- Tuple of IDs
        """

    def getRelativeContentURL(content):
        """ Get the URL for an object, relative to the portal root.

        This is helpful for virtual hosting situations.
        Same method as 'getRelativeURL()'

        Permission -- Always available

        Returns -- Slash-separated string
        """

    def getRelativeUrl(content):
        """ Get the URL for an object, relative to the portal root.

        This is helpful for virtual hosting situations.
        Same method as 'getRelativeContentURL()'

        Permission -- Always available

        Returns -- Slash-separated string
        """

    def getPortalPath():
        """ Get the portal object's URL without the server URL component.
class portal_patch(Interface):
    """Defines an interface for a tool that provides patch 
    (as in modification based on a diff) capabilities"""

    id = Attribute('id', 'Must be set to "portal_patch"')

    def createPatch(ob1, ob2, **kw):
        """Create and return a new patch object"""

    def searchPatches(**kw):
        """Find patches with the specified parameters"""
Пример #22
0
class IStoreEvent(IGatewayEvent):
    """Interface for events involved in storing objects."""

    is_new = Attribute(
        "is_new", """True if the object is new.

    When this attribute is true, gateways should not overwrite
    existing data but instead raise an OIDConflictError if something
    is in the way.  When it is false, gateways should overwrite
    existing data.
    """)
class portal_pdflatex(Interface):
    """Defines an interface for a tool that converts content to a PDF file"""

    id = Attribute('id', 'Must be set to "portal_pdflatex"')

    def convertObjectToPDF(object, style, **params):
        """
        Convert the given object to a PDF file, possible using its subjects as necessary
        """

    def convertFSDirToPDF(path, filename, style='', **params):
        """
class IVersionInfo(Interface):
    """
    Interface for version information.
    """

    objectId = Attribute(
        'objectId',
        "A ID string acting as a unique object identifier in the repository")

    version = Attribute('version',
                        "A string representing this object's version")

    user = Attribute(
        'user',
        "The name of the user who checked in this version of the object")

    message = Attribute(
        'message', "Optional comment by the user who checked in the object")

    timestamp = Attribute(
        'timestamp',
        "DateTime object indicating when the object was checked in")
Пример #25
0
class portal_discussion(Base):
    '''Links content to discussions.
    '''
    id = Attribute('id', 'Must be set to "portal_discussion"')

    #getDiscussionFor__roles__ = None
    def getDiscussionFor(content):
        '''Gets the PortalDiscussion object that applies to content.
        '''

    #isDiscussionAllowedFor__roles__ = None
    def isDiscussionAllowedFor(content):
        '''Returns a boolean indicating whether a discussion is
Пример #26
0
class portal_fsimport(Interface):
    """Defines an interface for a tool that provides import/export
    facilities between the ZODB and the filesystem"""

    id = Attribute('id', 'Must be set to "portal_fsimport"')

    def importFromFS(path, container):
        """
        Recursively import 'path' from the filesystem into the specified container.
        'container' must be a PortalFolder-like object
        """

    def exportToFS(path, object):
        """
Пример #27
0
class ISDEvent(IMapperEvent):
    """Base for serialization and deserialization events."""

    obj_db = Attribute("obj_db", "The relevant object database")

    obj = Attribute("obj", "The object being (de)serialized.")

    serializer_name = Attribute("serializer_name", "The serializer in use.")

    upos = Attribute(
        "upos", """The list of unmanaged persistent objects.

    If no attention is paid to unmanaged persistent objects (UPOs),
    they will not notify ZODB when they are changed, and hence can be
    a challenge for the application programmer.  Add UPOs to this list
    so that ZODB will see changes made to them and save the
    corresponding managed persistent object.""")

    external = Attribute(
        "external", """The list of external oids.

    The list is built up during (de)serialization.  It contains
    [(oid, subobject)].""")
Пример #28
0
class oldstyle_portal_discussion(Interface):
    """ Links content to discussions.
    """
    id = Attribute('id', 'Must be set to "portal_discussion"')

    #getDiscussionFor__roles__ = None
    def getDiscussionFor(content):
        """
            Find / create the DiscussionItemContainer for 'content'.
        """

    #isDiscussionAllowedFor__roles__ = None
    def isDiscussionAllowedFor(content):
        """
Пример #29
0
class oldstyle_portal_discussion(Interface):
    """ Links content to discussions.
    """
    id = Attribute('id', 'Must be set to "portal_discussion"')

    def getDiscussionFor(content):
        """ Get DiscussionItemContainer for content, create it if necessary.

        Permission -- Always available

        Returns -- DiscussionItemContainer object
        """

    def isDiscussionAllowedFor(content):
        """ Get boolean indicating whether discussion is allowed for content.
Пример #30
0
class IVersionedObject(Interface):
    """
    Interface for a specific version of an object in the repository
    """

    objectId = Attribute(
        'objectId', 'The ID string of the object what this is a version of')

    version = Attribute('version',
                        "A string representing this object's version")

    submitter = Attribute(
        'submitter',
        "The username of the person who published this version of the object")

    submitlog = Attribute(
        'submitlog',
        "The comment by the person who published this version of the object")

    def url():
        """Return the canonical URL used to access the object version"""

    def getParent():
        """Return the parent object from which this object derives, or None if no such object exists"""