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


Python IReferenceable.providedBy方法代码示例

本文整理汇总了Python中Products.Archetypes.interfaces.IReferenceable.providedBy方法的典型用法代码示例。如果您正苦于以下问题:Python IReferenceable.providedBy方法的具体用法?Python IReferenceable.providedBy怎么用?Python IReferenceable.providedBy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Products.Archetypes.interfaces.IReferenceable的用法示例。


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

示例1: _notifyOfCopyTo

# 需要导入模块: from Products.Archetypes.interfaces import IReferenceable [as 别名]
# 或者: from Products.Archetypes.interfaces.IReferenceable import providedBy [as 别名]
    def _notifyOfCopyTo(self, container, op=0):
        """In the case of a move (op=1) we need to make sure
        references are mainained for all referencable objects within
        the one being moved.

        manage_renameObject calls _notifyOfCopyTo so that the
        object being renamed doesn't lose its references. But
        manage_renameObject calls _delObject which calls
        manage_beforeDelete on all the children of the object
        being renamed which deletes all references for children
        of the object being renamed. Here is a patch that does
        recursive calls for _notifyOfCopyTo to address that
        problem.
        """
        # XXX this doesn't appear to be necessary anymore, if it is
        # it needs to be used in BaseBTreeFolder as well, it currently
        # is not.
        BaseObject._notifyOfCopyTo(self, container, op=op)
        # keep reference info internally when op == 1 (move)
        # because in those cases we need to keep refs
        if op==1:
            self._v_cp_refs = 1
        for child in self.contentValues():
            if IReferenceable.providedBy(child):
                child._notifyOfCopyTo(self, op)
开发者ID:dtgit,项目名称:dtedu,代码行数:27,代码来源:BaseFolder.py

示例2: get_references

# 需要导入模块: from Products.Archetypes.interfaces import IReferenceable [as 别名]
# 或者: from Products.Archetypes.interfaces.IReferenceable import providedBy [as 别名]
    def get_references(self):
        """ AT references
        """
        try:
            from Products.Archetypes.interfaces import IReferenceable
            if not IReferenceable.providedBy(self.context):
                return
        except:
            return

        self['_atrefs'] = {}
        self['_atbrefs'] = {}
        relationships = self.context.getRelationships()
        for rel in relationships:
            self['_atrefs'][rel] = []
            refs = self.context.getRefs(relationship=rel)
            for ref in refs:
                if ref is not None:
                    self['_atrefs'][rel].append('/'.join(ref.getPhysicalPath()))
        brelationships = self.context.getBRelationships()
        for brel in brelationships:
            self['_atbrefs'][brel] = []
            brefs = self.context.getBRefs(relationship=brel)
            for bref in brefs:
                if bref is not None:
                    self['_atbrefs'][brel].append('/'.join(bref.getPhysicalPath()))
开发者ID:atreal,项目名称:collective.jsonify,代码行数:28,代码来源:wrapper.py

示例3: checkout_allowed

# 需要导入模块: from Products.Archetypes.interfaces import IReferenceable [as 别名]
# 或者: from Products.Archetypes.interfaces.IReferenceable import providedBy [as 别名]
    def checkout_allowed(self):
        """Check if a checkout is allowed.
        """
        context = aq_inner(self.context)
        checkPermission = getSecurityManager().checkPermission
        
        if not interfaces.IIterateAware.providedBy(context):
            return False
        
        if not IReferenceable.providedBy(context):
            return False

        archiver = interfaces.IObjectArchiver(context)
        if not archiver.isVersionable():
            return False

        # check if there is an existing checkout
        if len(context.getBRefs(WorkingCopyRelation.relationship)) > 0:
            return False
        
        # check if it is a checkout or contains a checkout
        if recursivelyCheckForWorkingCopies(context):
            return False

        # check if it is contained by a checkout
        if recursivelyCheckParentsForWorkingCopies(context):
            return False

        # check the permission
        if not checkPermission(permissions.CheckoutPermission, context):
            return False
        
        return True
开发者ID:tdenny,项目名称:plone.app.iterate,代码行数:35,代码来源:control.py

示例4: update_links

# 需要导入模块: from Products.Archetypes.interfaces import IReferenceable [as 别名]
# 或者: from Products.Archetypes.interfaces.IReferenceable import providedBy [as 别名]
def update_links(event):
    obj = event.object
    if is_outdated(obj) or not is_publically_visible(obj):
        return
    temporary = hasattr(obj, 'meta_type') and \
        obj.meta_type == TempFolder.meta_type
    if temporary:
        # Objects that are temporary (read: portal_factory) and do not have a
        # (stable) URL (yet) do not need to be crawled: relative links will be
        # off quickly and we can't really use the UID anyway.
        return
    try:
        link_checker = getToolByName(obj, 'portal_linkchecker').aq_inner
    except AttributeError:
        return
    if not link_checker.active:
        return
    retriever = IRetriever(obj, None)
    if retriever is not None:
        sm = getSecurityManager()
        if not sm.checkPermission(ModifyPortalContent, obj):
            return
        if (not IReferenceable.providedBy(obj)):
            return
        async = getUtility(IAsyncService)
        tpath = '/'.join(obj.getPhysicalPath())
        job = async.queueJob(retrieve_async, obj, tpath, online=True)
        callback = job.addCallbacks(failure=job_failure_callback)
        callback  # for pep
开发者ID:EU-OSHA,项目名称:osha.policy,代码行数:31,代码来源:handlers.py

示例5: transmogrify

# 需要导入模块: from Products.Archetypes.interfaces import IReferenceable [as 别名]
# 或者: from Products.Archetypes.interfaces.IReferenceable import providedBy [as 别名]
    def transmogrify(self, item):
        path = self.get_path(item)
        obj = self.get_object(item)

        uid = item.get(self.uidkey, "")
        if not uid:
            raise NothingToDoHere

        at_uid = ATIReferenceable.providedBy(obj)
        dx_uid = DXIReferenceable.providedBy(obj)

        old_uid = obj.UID()
        if old_uid != uid:
            # Code from plone.app.transmogrifier used for AT objects:
            if at_uid:
                if not old_uid:
                    setattr(obj, AT_UUID_ATTR, uid)
                else:
                    obj._setUID(uid)
            elif dx_uid:
                setattr(obj, DX_UID_ATTR, uid)
            else: #Don't ask, JUST DO IT!
                  # If the attribute is not used as UID, it
                  # is not used as anything else as well,
                  # and at least the desired UID value stays recorded in the
                  # object, allowing for a post-migration retrieval
                setattr(obj, DEFAULT_UID_ATTR, uid)
        return item
开发者ID:simplesconsultoria,项目名称:sc.transmogrifier,代码行数:30,代码来源:universal_uid_updater.py

示例6: __iter__

# 需要导入模块: from Products.Archetypes.interfaces import IReferenceable [as 别名]
# 或者: from Products.Archetypes.interfaces.IReferenceable import providedBy [as 别名]
    def __iter__(self):

        for item in self.previous:

            pathkey = self.pathkey(*item.keys())[0]
            uidkey = self.uidkey(*item.keys())[0]

            if not pathkey or not uidkey:  # not enough info
                yield item
                continue

            path = item[pathkey]
            uid = item[uidkey]

            obj = traverse(self.context, str(path).lstrip('/'), None)
            if obj is None:  # path doesn't exist
                yield item
                continue

            if IReferenceable.providedBy(obj):
                oldUID = obj.UID()
                if oldUID != uid:
                    if not oldUID:
                        setattr(obj, UUID_ATTR, uid)
                    else:
                        obj._setUID(uid)

            if IAttributeUUID.providedBy(obj):
                IMutableUUID(obj).set(uid)

            yield item
开发者ID:collective,项目名称:plone.app.transmogrifier,代码行数:33,代码来源:uidupdater.py

示例7: getObjectsFromLinks

# 需要导入模块: from Products.Archetypes.interfaces import IReferenceable [as 别名]
# 或者: from Products.Archetypes.interfaces.IReferenceable import providedBy [as 别名]
def getObjectsFromLinks(base, links):
    """ determine actual objects refered to by given links """
    objects = set()
    url = base.absolute_url()
    scheme, host, path, query, frag = urlsplit(url)
    for link in links:
        s, h, path, q, f = urlsplit(link)
        # relative or local url
        if (not s and not h) or (s == scheme and h == host):
            # Paths should always be strings
            if isinstance(path, unicode):
                path = path.encode('utf-8')

            obj, extra = findObject(base, path)
            if obj:
                if IOFSImage.providedBy(obj):
                    # use atimage object for scaled images
                    obj = aq_parent(obj)
                if not IReferenceable.providedBy(obj):
                    try:
                        obj = IReferenceable(obj)
                    except:
                        continue
                objects.add(obj)
    return objects
开发者ID:urska19,项目名称:Plone-test,代码行数:27,代码来源:handlers.py

示例8: beforeChange_at_uuid

# 需要导入模块: from Products.Archetypes.interfaces import IReferenceable [as 别名]
# 或者: from Products.Archetypes.interfaces.IReferenceable import providedBy [as 别名]
 def beforeChange_at_uuid(self):
     """Load AT universal uid."""
     self._checkLoadAttr('UID')
     if IReferenceable.providedBy(self.old):
         self.UID = self.old.UID()
         self.old._uncatalogUID(self.parent)
     else:
         self.UID = None
开发者ID:plone,项目名称:Products.contentmigration,代码行数:10,代码来源:inplace.py

示例9: getuid

# 需要导入模块: from Products.Archetypes.interfaces import IReferenceable [as 别名]
# 或者: from Products.Archetypes.interfaces.IReferenceable import providedBy [as 别名]
 def getuid(self):
     if HAS_PLONE_UUID:
         uid = IUUID(self.context, None)
         if uid is not None:
             return uid
     if HAS_AT:
         if IReferenceable.providedBy(self.context):
             return self.context.UID()
     return None
开发者ID:collective,项目名称:collective.inviting,代码行数:11,代码来源:item.py

示例10: prepareIterateObjectTabs

# 需要导入模块: from Products.Archetypes.interfaces import IReferenceable [as 别名]
# 或者: from Products.Archetypes.interfaces.IReferenceable import providedBy [as 别名]
 def prepareIterateObjectTabs(self, *args, **kwargs):
     tabs = self.prepareObjectTabs(*args, **kwargs)
     
     if IReferenceable.providedBy(self.context):
         iterate_control = plone.app.iterate.browser.control.Control(self.context, self.request)
         if tabs and iterate_control.checkout_allowed():
             for tab in [e for e in tabs if e['id'] == 'edit']:
                 tab['url'] = self.context.absolute_url() + '/@@content-checkout'
      
     return tabs
开发者ID:ceko,项目名称:ceko.iterate,代码行数:12,代码来源:viewlets.py

示例11: getSourceId

# 需要导入模块: from Products.Archetypes.interfaces import IReferenceable [as 别名]
# 或者: from Products.Archetypes.interfaces.IReferenceable import providedBy [as 别名]
 def getSourceId(self, name, filename, instance, fresh=False):
     sid = ''
     if IReferenceable.providedBy(instance):
         sid = sid + instance.UID()
     sid = "%s_%s" % (sid, self.make_prefix())
     sid = "%s_%s" % (sid, name)
     fname = self.getNormalizedName(filename)
     if fname:
         sid = '%s_%s' % (sid, fname)
     return sid
开发者ID:quintagroup,项目名称:collective.contentfiles2aws,代码行数:12,代码来源:storage.py

示例12: test_upgrade

# 需要导入模块: from Products.Archetypes.interfaces import IReferenceable [as 别名]
# 或者: from Products.Archetypes.interfaces.IReferenceable import providedBy [as 别名]
 def test_upgrade(self):
     doc3 = self.portal['doc3']
     doc1 = self.portal['doc1']
     self.assertTrue(IReferenceable.providedBy(doc3))
     doc3.setText('<a href="doc1">doc1</a>', mimetype='text/html')
     doc3.addReference(doc1, relationship=referencedRelationship)
     self.assertFalse(hasIncomingLinks(doc1))
     self.assertFalse(hasIncomingLinks(doc3))
     migrate_linkintegrity_relations(self.portal)
     self.assertTrue(hasIncomingLinks(doc1))
     self.assertFalse(hasIncomingLinks(doc3))
开发者ID:FHNW,项目名称:plone.app.linkintegrity,代码行数:13,代码来源:test_upgrade.py

示例13: migrate_at_uuid

# 需要导入模块: from Products.Archetypes.interfaces import IReferenceable [as 别名]
# 或者: from Products.Archetypes.interfaces.IReferenceable import providedBy [as 别名]
 def migrate_at_uuid(self):
     """Migrate AT universal uid
     """
     if not IReferenceable.providedBy(self.old):
         return  # old object doesn't support AT uuids
     uid = self.old.UID()
     self.old._uncatalogUID(self.parent)
     if queryAdapter(self.new, IMutableUUID):
         IMutableUUID(self.new).set(str(uid))
     else:
         self.new._setUID(uid)
开发者ID:jean,项目名称:Products.contentmigration,代码行数:13,代码来源:migrator.py

示例14: migrate_at_uuid

# 需要导入模块: from Products.Archetypes.interfaces import IReferenceable [as 别名]
# 或者: from Products.Archetypes.interfaces.IReferenceable import providedBy [as 别名]
 def migrate_at_uuid(self):
     """Migrate AT universal uid
     """
     if not IReferenceable.providedBy(self.old):
         return  # old object doesn't support AT uuids
     uid = self.old.UID()
     self.old._uncatalogUID(self.parent)
     if UUID_ATTR:  # Prevent object deletion triggering UID related magic
         setattr(self.old, UUID_ATTR, None)
     if queryAdapter(self.new, IMutableUUID):
         IMutableUUID(self.new).set(str(uid))
     else:
         self.new._setUID(uid)
开发者ID:CGTIC,项目名称:Plone_SP,代码行数:15,代码来源:migrator.py

示例15: __call__

# 需要导入模块: from Products.Archetypes.interfaces import IReferenceable [as 别名]
# 或者: from Products.Archetypes.interfaces.IReferenceable import providedBy [as 别名]
    def __call__(self, skipRedirect=False, **args):
        context = self.context
        request = context.REQUEST
        if IReferenceable.providedBy(context):
            plone_utils = getToolByName(context, 'plone_utils')
            uid = request.get('uid', '')
            remoteUrl = request.get('remoteUrl', '')
            if not remoteUrl:
                message = u'No URL was given, nothing has been added.'
            else:
                util = getUtility(ISearchUrlSettings)
                urlTuples = util.urls
                existing = list()
                existing_idx = list()
                pc = context.portal_catalog
                for item in urlTuples:
                    if item.url == remoteUrl:
                        res = pc(UID=item.provider)
                        title = len(res) and res[0].Title or 'None'
                        url = len(res) and res[0].getURL() or ''
                        existing.append("existing:list=%s|%s" % (title, url))
                        existing_idx.append(urlTuples.index(item))
                if len(existing):
                    if not request.get('override', False):
                        message = u"The URL is already registered"
                        path = context.absolute_url() + "/%s?%s" % (
                            request.get('template_id', ''),
                            '&'.join(existing) )
                        plone_utils.addPortalMessage(message)
                        skipRedirect = True
                        self.request.RESPONSE.redirect(path)
                        return
                    else:
                        existing_idx.reverse()
                        for idx in existing_idx:
                            del urlTuples[idx]

                urlTuples.append(SearchUrlTuple(remoteUrl, uid))
                util.urls = urlTuples

                message = (u'"%s" has been added to search urls' %
                           unicode(context.title_or_id(), 'utf-8'))
        else:
            message = (u'"%s" could not be added to the search, because ist'
                       'is not referenceable' %
                       unicode(context.title_or_id(), 'utf-8'))

        if not skipRedirect:
            path = context.absolute_url()
            plone_utils.addPortalMessage(message)
            self.request.RESPONSE.redirect(path)
开发者ID:syslabcom,项目名称:osha.searchurls,代码行数:53,代码来源:search_urls.py


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