当前位置: 首页>>代码示例>>Python>>正文


Python PortalFolder.PortalFolderBase类代码示例

本文整理汇总了Python中Products.CMFCore.PortalFolder.PortalFolderBase的典型用法代码示例。如果您正苦于以下问题:Python PortalFolderBase类的具体用法?Python PortalFolderBase怎么用?Python PortalFolderBase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了PortalFolderBase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

    def __init__(self, id=None, **kwargs):
        OFSContainer.__init__(self, id, **kwargs)
        PortalFolderBase.__init__(self, id, **kwargs)
        DefaultDublinCoreImpl.__init__(self, **kwargs)

        if id is not None:
            self.id = id
开发者ID:4teamwork,项目名称:plone.app.content,代码行数:7,代码来源:container.py

示例2: __call__

    def __call__(self, context):
        # catch some bad contexts (such as KSS validator)
        try:
            context.portal_type
        except AttributeError:
            return []

        # get default allowed types, but not the allowed types directly from
        # the context because they may already be filtered.
        if not isinstance(context, PortalFolderBase):
            return []
        types = PortalFolderBase.allowedContentTypes(context)

        # find the dexterity FTIs using the IRestrictedDossier behavior
        restricted_types = filter(
            lambda fti: getattr(fti, 'behaviors', []) and
                self.marker_behavior in fti.behaviors, types)

        # create the terms
        terms = []
        for fti in restricted_types:
            title = translate(fti.title,
                              domain=fti.i18n_domain,
                              context=context.REQUEST)
            terms.append(SimpleVocabulary.createTerm(
                    fti.id, fti.id, title))

        # create the vocabulary
        return SimpleVocabulary(terms)
开发者ID:4teamwork,项目名称:opengever.core,代码行数:29,代码来源:vocabularies.py

示例3: _checkId

def _checkId(self, id, allow_dup=0):
        PortalFolderBase.inheritedAttribute('_checkId')(self, id, allow_dup)

        if allow_dup:
            return

        # FIXME: needed to allow index_html for join code
        if id == 'index_html':
            return

        # Another exception: Must allow "syndication_information" to enable
        # Syndication...
        if id == 'syndication_information':
            return

        # IDs starting with '@@' are reserved for views.
        if id[:2] == '@@':
            raise BadRequest('The id "%s" is invalid because it begins with '
                             '"@@".' % id)
开发者ID:austgl,项目名称:everydo-project,代码行数:19,代码来源:patch.py

示例4: contentValues

    def contentValues(self, filter=None, sort_on=None, reverse=0):
        # Able to sort on field.
        values = PortalFolderBase.contentValues(self, filter=filter)
        if sort_on is not None:
            values.sort(lambda x, y,
                        sort_on=sort_on: safe_cmp(getattr(x, sort_on),
                                                  getattr(y, sort_on)))
        if reverse:
            values.reverse()

        return values
开发者ID:zopyx,项目名称:Products.CMFPlone,代码行数:11,代码来源:PloneFolder.py

示例5: manage_delObjects

 def manage_delObjects(self, ids=[], REQUEST=None):
     """We need to enforce security."""
     mt = getToolByName(self, 'portal_membership')
     if type(ids) is StringType:
         ids = [ids]
     for id in ids:
         item = self._getOb(id)
         if not mt.checkPermission(Permissions.delete_objects, item):
             raise Unauthorized, (
                 "Do not have permissions to remove this object")
     return PortalFolderBase.manage_delObjects(self, ids, REQUEST=REQUEST)
开发者ID:dtgit,项目名称:dtedu,代码行数:11,代码来源:PloneFolder.py

示例6: _verifyObjectPaste

 def _verifyObjectPaste(self, object, validate_src=1):
     """Overrides PortalFolder._verifyObjectPaste."""
     # What we do here is trick PortalFolder._verifyObjectPaste in its check
     # for allowed content types. We make our typeinfo temporarily
     # unavailable.
     pt = getToolByName(self, 'portal_types')
     tmp_name = '%s_TMP' % self.portal_type
     ti = pt.getTypeInfo(self.portal_type)
     pt.manage_delObjects([self.portal_type])
     value = PortalFolderBase._verifyObjectPaste(self, object, validate_src)
     pt._setObject(self.portal_type, ti)
     return value
开发者ID:CMcStone,项目名称:Products.Relations,代码行数:12,代码来源:utils.py

示例7: _catalogRefs

    def _catalogRefs(self, aq, uc=None, rc=None):
        ruleset.RLMWithBrains._catalogRefs(self,aq,uc,rc)
        
        # Use the PortalFolderBase implementation to avoid the false
        # result from a bogus inheritence of SimpleItem
        names = PortalFolderBase.objectIds(self)
        
        for name in names:
            if not shasattr(self, name):
                break

            obj=getattr(self,name)
            if obj:
                #import pdb;pdb.set_trace()
                if not uc:
                    uc = getToolByName(aq, config.UID_CATALOG)
                if not rc:
                    rc = getToolByName(aq, config.REFERENCE_CATALOG)
    
                url = getRelURL(uc, obj.getPhysicalPath())
                uc.catalog_object(obj, url)
                #rc.catalog_object(obj, url)
                
                obj._catalogRefs(uc, uc, rc)
开发者ID:plone,项目名称:Products.Relations,代码行数:24,代码来源:contentreference.py

示例8: _checkId

 def _checkId(self, id, allow_dup=0):
     PortalFolderBase._checkId(self, id, allow_dup)
     BTreeFolder2Base._checkId(self, id, allow_dup)
开发者ID:plone,项目名称:plone.folder,代码行数:3,代码来源:ordered.py

示例9: __init__

 def __init__(self, id, title=''):
     PortalFolderBase.__init__(self, id, title)
     BTreeFolder2Base.__init__(self, id)
开发者ID:plone,项目名称:plone.folder,代码行数:3,代码来源:ordered.py

示例10: getImmediatelyAddableTypes

    def getImmediatelyAddableTypes(self, context=None):
        """Get the list of type ids which should be immediately addable.
        If enableTypeRestrictions is ENABLE, return the list set; if it is
        ACQUIRE, use the value from the parent; if it is DISABLE, return
        all type ids allowable on the item.
        """
        if context is None:
            context = self
        mode = self.getConstrainTypesMode()

        if mode == DISABLED:
            return [fti.getId() for fti in \
                        self.getDefaultAddableTypes(context)]
        elif mode == ENABLED:
            return self.getField('immediatelyAddableTypes').get(self)
        elif mode == ACQUIRE:
            parent = getParent(self)
            if not parent or parent.portal_type == 'Plone Site':
                return [fti.getId() for fti in \
                        PortalFolder.allowedContentTypes(self)]
            elif not parentPortalTypeEqual(self):
                default_allowed = [fti.getId() for fti in \
                        PortalFolder.allowedContentTypes(self)]
                return [t for t in parent.getImmediatelyAddableTypes(context) \
                           if t in default_allowed]
            else:
                parent = aq_parent(aq_inner(self))
                return parent.getImmediatelyAddableTypes(context)
        else:
            raise ValueError, "Invalid value for enableAddRestriction"
开发者ID:CGTIC,项目名称:Plone_SP,代码行数:30,代码来源:constraintypes.py

示例11: allowedContentTypes

def allowedContentTypes(self, context=None):
    """
    returns constrained allowed types as list of fti's.
    There is a try/except for handle AT folders inside DX containers
    """
    if context is None:
        context = self
    mode = self.getConstrainTypesMode()

    # Short circuit if we are disabled or acquiring from non-compatible
    # parent

    parent = getParent(self)
    if mode == DISABLED or (mode == ACQUIRE and not parent):
        return PortalFolder.allowedContentTypes(self)
    elif mode == ACQUIRE and not parentPortalTypeEqual(self):
        globalTypes = self.getDefaultAddableTypes(context)
        if parent.portal_type == 'Plone Site':
            return globalTypes
        else:
            try:
                allowed = list(parent.getLocallyAllowedTypes(context))
            except AttributeError:
                # parent is a DX content?
                behavior = ISelectableConstrainTypes(parent)
                if not behavior:
                    # return context addable types
                    return get_context_ftis(self)
                allowed = behavior.getLocallyAllowedTypes(context)
            return [fti for fti in globalTypes if fti.getId() in allowed]
    else:
        return get_context_ftis(self)
开发者ID:RedTurtle,项目名称:experimental.atconstraintypes,代码行数:32,代码来源:monkey.py

示例12: allowedContentTypes

    def allowedContentTypes(self, context=None):
        """returns constrained allowed types as list of fti's
        """
        if context is None:
            context = self
        mode = self.getConstrainTypesMode()

        # Short circuit if we are disabled or acquiring from non-compatible
        # parent

        parent = getParent(self)
        if mode == DISABLED or (mode == ACQUIRE and not parent):
            return PortalFolder.allowedContentTypes(self)
        elif mode == ACQUIRE and not parentPortalTypeEqual(self):
            globalTypes = self.getDefaultAddableTypes(context)
            if parent.portal_type == 'Plone Site':
                return globalTypes
            else:
                allowed = list(parent.getLocallyAllowedTypes(context))
                return [fti for fti in globalTypes if fti.getId() in allowed]
        else:
            globalTypes = self.getDefaultAddableTypes(context)
            allowed = list(self.getLocallyAllowedTypes())
            ftis = [fti for fti in globalTypes if fti.getId() in allowed]
            return ftis
开发者ID:CGTIC,项目名称:Plone_SP,代码行数:25,代码来源:constraintypes.py

示例13: getImmediatelyAddableTypes

def getImmediatelyAddableTypes(self, context=None):
    """Get the list of type ids which should be immediately addable.
    If enableTypeRestrictions is ENABLE, return the list set; if it is
    ACQUIRE, use the value from the parent; if it is DISABLE, return
    all type ids allowable on the item.
    There is a try/except for handle AT folders inside DX containers
    """
    if context is None:
        context = self
    mode = self.getConstrainTypesMode()

    if mode == DISABLED:
        return [fti.getId() for fti in self.getDefaultAddableTypes(context)]
    elif mode == ENABLED:
        return self.getField('immediatelyAddableTypes').get(self)
    elif mode == ACQUIRE:
        parent = getParent(self)
        if not parent or parent.portal_type == 'Plone Site':
            return [fti.getId() for fti in
                    PortalFolder.allowedContentTypes(self)]
        elif not parentPortalTypeEqual(self):
            default_allowed = [fti.getId() for fti in
                               PortalFolder.allowedContentTypes(self)]
            try:
                immediately_addable = parent.getImmediatelyAddableTypes(context)
            except AttributeError:
                # parent is a DX content?
                behavior = ISelectableConstrainTypes(parent)
                if not behavior:
                    # return context default addable types
                    immediately_addable = self.getField('immediatelyAddableTypes').get(self)
                immediately_addable = behavior.getImmediatelyAddableTypes(context)
            return [t for t in immediately_addable if t in default_allowed]
        else:
            parent = aq_parent(aq_inner(self))
            try:
                return parent.getImmediatelyAddableTypes(context)
            except AttributeError:
                # parent is a DX content?
                behavior = ISelectableConstrainTypes(parent)
                if not behavior:
                    # return context default addable types
                    return self.getField('immediatelyAddableTypes').get(self)
                return behavior.getImmediatelyAddableTypes(context)
    else:
        raise ValueError, "Invalid value for enableAddRestriction"
开发者ID:RedTurtle,项目名称:experimental.atconstraintypes,代码行数:46,代码来源:monkey.py

示例14: listFolderContents

    def listFolderContents(self, contentFilter=None, suppressHiddenFiles=0):
        # Optionally you can suppress "hidden" files, or files that begin
        # with a dot.
        contents = PortalFolder.listFolderContents(self, contentFilter=contentFilter)
        if suppressHiddenFiles:
            contents = [obj for obj in contents if obj.getId()[:1] != '.']

        return contents
开发者ID:CGTIC,项目名称:Plone_SP,代码行数:8,代码来源:BaseFolder.py

示例15: manage_delObjects

 def manage_delObjects(self, ids=[], REQUEST=None):
     """We need to enforce security."""
     if isinstance(ids, basestring):
         ids = [ids]
     for id in ids:
         item = self._getOb(id)
         if not _checkPermission(permissions.DeleteObjects, item):
             raise Unauthorized, (
                 "Do not have permissions to remove this object")
     return PortalFolder.manage_delObjects(self, ids, REQUEST=REQUEST)
开发者ID:dtgit,项目名称:dtedu,代码行数:10,代码来源:BaseFolder.py


注:本文中的Products.CMFCore.PortalFolder.PortalFolderBase类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。