コード例 #1
0
    def __class_init__(self):
        try:    mt=list(self.meta_types)
        except: mt=[]
        for b in self.__bases__:
            try:
                for t in b.meta_types:
                    if t not in mt: mt.append(t)
            except: pass
        mt.sort()
        self.meta_types=tuple(mt)

        default__class_init__(self)
コード例 #2
0
ファイル: Discussions.py プロジェクト: bendavis78/zope
    
        self.in_reply_to = urllib.unquote(reply_url)

        if hasattr(self, 'reindexObject'):
            self.reindexObject()

    def parentsInThread(self, size=0):
        """
            Return the list of object which are this object's parents,
            from the point of view of the threaded discussion.
            Parents are ordered oldest to newest.

            If 'size' is not zero, only the closest 'size' parents
            will be returned.
        """

        parents = []
        parent = self.inReplyTo()

        while parent and (not size or len(parents) < size):
            if parent in parents:
                # Paranoia: circular thread
                print self.absolute_url(), "is in a circular thread"
                break
            parents.append(parent)
            parent = hasattr(parent, 'inReplyTo') and parent.inReplyTo()
        parents.reverse()
        return parents

default__class_init__(Discussable)
コード例 #3
0
ファイル: DublinCore.py プロジェクト: bendavis78/zope
    #

    def editMetadata( self
                    , title=''
                    , subject=()
                    , description=''
                    , contributors=()
                    , effective_date=None
                    , expiration_date=None
                    , format='text/html'
                    , language='en-US'
                    , rights=''
                    ):
        """
            Update the editable metadata for this resource.
        """
        self.setTitle( title )
        self.setSubject( subject )
        self.setDescription( description )
        self.setContributors( contributors )
        self.setEffectiveDate( effective_date )
        self.setExpirationDate( expiration_date )
        self.setFormat( format )
        self.setLanguage( language )
        self.setRights( rights )

    editMetadata = WorkflowAction(editMetadata)


default__class_init__(DefaultDublinCoreImpl)
コード例 #4
0
ファイル: RegistrationTool.py プロジェクト: bendavis78/zope
        '''
        if member is None:
            # New member.
            username = props.get('username', '')
            if not username:
                return 'You must enter a valid name.'
            if not self.isMemberIdAllowed(username):
                return 'The login name you selected is already ' \
                       'in use or is not valid. Please choose another.'
            if not props.get('email', ''):
                return 'You must enter a valid email address.'
        return None

    def mailPassword(self, forgotten_userid, REQUEST):
        '''Email a forgotten password to a member.  Raises an exception
        if user ID is not found.
        '''
        membership = getToolByName(self, 'portal_membership')
        member = membership.getMemberById(forgotten_userid)
        if member is None:
            raise 'NotFound', 'The username you entered could not be found.'
    
        return self.mail_password_template(
            self, REQUEST,
            member=member,
            password=member.getPassword()
            )


default__class_init__(RegistrationTool)
コード例 #5
0
ファイル: URLTool.py プロジェクト: goschtl/zope
    meta_type = 'Default URL Tool'

    def __call__(self, *args, **kw):
        '''
        Returns the absolute URL of the portal.
        '''
        return self.aq_inner.aq_parent.absolute_url()

    getRelativeUrl__roles__ = None
    def getRelativeUrl(self, content):
        """
        Returns a URL for an object that is relative 
        to the portal root. This is helpful for virtual hosting
        situations.
        """
        portal_path_length = len(self.aq_inner.aq_parent.getPhysicalPath())
        content_location = content.getPhysicalPath()
        rel_path = content_location[portal_path_length:]

        return string.join(rel_path, '/')

    getPortalPath__roles__ = None
    def getPortalPath(self):
        """
        Returns the portal object's URL without the server URL component
        """
        return string.join(self.aq_inner.aq_parent.getPhysicalPath(), '/')


default__class_init__(URLTool)
コード例 #6
0
ファイル: PropertiesTool.py プロジェクト: bendavis78/zope
__version__ = '$Revision$'[11:-2]

from Products.CMFCore.utils import UniqueObject
from OFS.SimpleItem import SimpleItem
from Globals import default__class_init__


class PropertiesTool(UniqueObject, SimpleItem):
    id = 'portal_properties'
    meta_type = 'Default Properties Tool'

    __ac_permissions__ = (('Manage portal', ('editProperties', )), )

    def editProperties(self, props):
        '''Change portal settings'''
        self.aq_inner.aq_parent.manage_changeProperties(props)
        self.MailHost.smtp_host = props['smtp_server']
        if hasattr(self, 'propertysheets'):
            ps = self.propertysheets
            if hasattr(ps, 'props'):
                ps.props.manage_changeProperties(props)

    def title(self):
        return self.aq_inner.aq_parent.title

    def smtp_server(self):
        return self.MailHost.smtp_host


default__class_init__(PropertiesTool)
コード例 #7
0
from utils import getToolByName

PORTAL_SKINS_TOOL_ID = 'portal_skins'


class PortalObjectBase(PortalFolder, SkinnableObjectManager):

    meta_type = 'Portal Site'
    _isPortalRoot = 1

    # Ensure certain attributes come from the correct base class.
    __getattr__ = SkinnableObjectManager.__getattr__
    __of__ = SkinnableObjectManager.__of__
    _checkId = SkinnableObjectManager._checkId

    # Ensure all necessary permissions exist.
    __ac_permissions__ = (
        (AddPortalMember, ()),
        (SetOwnPassword, ()),
        (SetOwnProperties, ()),
        (MailForgottenPassword, ()),
        (RequestReview, ()),
        (ReviewPortalContent, ()),
        (AccessFuturePortalContent, ()),
        )

    def getSkinsFolderName(self):
        return PORTAL_SKINS_TOOL_ID

default__class_init__(PortalObjectBase)
コード例 #8
0
                    # Don't return the folder if the user can't get to it.
                    return None
                return folder
            except KeyError:
                pass
        return None

    def getHomeUrl(self, id=None, verifyPermission=0):
        """Returns the URL to a member's home folder."""
        home = self.getHomeFolder(id, verifyPermission)
        if home is not None:
            return home.absolute_url()
        else:
            return None

    def listActions(self, info):
        '''Lists actions available to the user.'''
        if not info.isAnonymous:
            homeUrl = self.getHomeUrl()
            if homeUrl is not None:
                return ({
                    'name': 'My Stuff',
                    'url': homeUrl + '/folder_contents',
                    'permissions': [],
                    'category': 'user'
                }, )
        return None


default__class_init__(MembershipTool)
コード例 #9
0
ファイル: DiscussionTool.py プロジェクト: bendavis78/zope
# This software consists of contributions made by Digital Creations and
# many individuals on behalf of Digital Creations.  Specific
# attributions are listed in the accompanying credits file.
# 
##############################################################################

"""Basic portal discussion access tool.
$Id$
"""
__version__='$Revision$'[11:-2]


from Globals import default__class_init__
from DiscussionItem import DiscussionItemContainer
from Products.CMFCore.DiscussionTool import DiscussionTool

class DiscussionTool (DiscussionTool):
    id = 'portal_discussion'
    meta_type = 'Default Discussion Tool'
    # This tool is used to find the discussion for a given content object.

    createDiscussionFor__roles__ = None
    def createDiscussionFor(self, object):
        """
        This method will create the object that holds 
        discussion items inside the object being discussed.
        """
        object.talkback = DiscussionItemContainer()

default__class_init__(DiscussionTool)
コード例 #10
0
ファイル: MembershipTool.py プロジェクト: goschtl/zope
                folder = self.Members[id]
                if verifyPermission and not _checkPermission('View', folder):
                    # Don't return the folder if the user can't get to it.
                    return None
                return folder
            except KeyError: pass
        return None
        
    def getHomeUrl(self, id=None, verifyPermission=0):
        """Returns the URL to a member's home folder."""
        home = self.getHomeFolder(id, verifyPermission)
        if home is not None:
            return home.absolute_url()
        else:
            return None

    def listActions(self, info):
        '''Lists actions available to the user.'''
        if not info.isAnonymous:
            homeUrl = self.getHomeUrl()
            if homeUrl is not None:
                return (
                    {'name': 'My Stuff',
                     'url': homeUrl + '/folder_contents',
                     'permissions': [],
                     'category': 'user'},
                    )
        return None

default__class_init__(MembershipTool)
コード例 #11
0
ファイル: URLTool.py プロジェクト: bendavis78/zope
    def __call__(self, *args, **kw):
        '''
        Returns the absolute URL of the portal.
        '''
        return self.aq_inner.aq_parent.absolute_url()

    getRelativeUrl__roles__ = None

    def getRelativeUrl(self, content):
        """
        Returns a URL for an object that is relative 
        to the portal root. This is helpful for virtual hosting
        situations.
        """
        portal_path_length = len(self.aq_inner.aq_parent.getPhysicalPath())
        content_location = content.getPhysicalPath()
        rel_path = content_location[portal_path_length:]

        return string.join(rel_path, '/')

    getPortalPath__roles__ = None

    def getPortalPath(self):
        """
        Returns the portal object's URL without the server URL component
        """
        return string.join(self.aq_inner.aq_parent.getPhysicalPath(), '/')


default__class_init__(URLTool)