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


Python proxy.removeAllProxies函数代码示例

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


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

示例1: commentRemoved

def commentRemoved(comment, ev):
    comment = removeAllProxies(comment)
    catalog = removeAllProxies(getCatalog())
    try:
        catalog.unindex_doc(getUtility(IIntIds).getId(comment))
    except KeyError:
        pass
开发者ID:Zojax,项目名称:zojax.content.discussion,代码行数:7,代码来源:catalog.py

示例2: testTraverseNameView

    def testTraverseNameView(self):
        pub = self.klass(self.db)

        class I(Interface):
            pass

        class C(object):
            implements(I)

        ob = C()

        class V(object):
            def __init__(self, context, request):
                pass

            implements(ISOAPPresentation)

        # Register the simple traverser so we can traverse without @@
        from z3c.soap.interfaces import ISOAPPublisher, ISOAPRequest
        from zope.app.publication.traversers import SimpleComponentTraverser

        ztapi.provideView(Interface, ISOAPRequest, ISOAPPublisher, "", SimpleComponentTraverser)

        r = self._createRequest("/@@spam", pub)
        ztapi.provideView(I, ISOAPRequest, Interface, "spam", V)
        ob2 = pub.traverseName(r, ob, "@@spam")
        self.assertEqual(removeAllProxies(ob2).__class__, V)

        ob2 = pub.traverseName(r, ob, "spam")
        self.assertEqual(removeAllProxies(ob2).__class__, V)
开发者ID:Goldmund-Wyldebeast-Wunderliebe,项目名称:z3c.soap,代码行数:30,代码来源:test_soappublication.py

示例3: testTraverseNameView

    def testTraverseNameView(self):
        pub = self.klass(self.db)

        class I(Interface):
            pass

        class C(object):
            implements(I)

        ob = C()

        class V(object):
            def __init__(self, context, request):
                pass
            implements(IXMLRPCView)


        # Register the simple traverser so we can traverse without @@
        component.provideAdapter(SimpleComponentTraverser,
                                 (Interface, IXMLRPCRequest),
                                 IXMLRPCPublisher)

        r = self._createRequest('/@@spam', pub)
        component.provideAdapter(V, (I, IXMLRPCRequest), Interface,
                                 name='spam')
        ob2 = pub.traverseName(r, ob, '@@spam')
        self.assertEqual(removeAllProxies(ob2).__class__, V)

        ob2 = pub.traverseName(r, ob, 'spam')
        self.assertEqual(removeAllProxies(ob2).__class__, V)
开发者ID:jean,项目名称:zope.app.publication,代码行数:30,代码来源:test_xmlrpcpublication.py

示例4: retract

    def retract(self, principal=None):
        if principal is None:
            principal = getPrincipal()

        if not self.isRetractable(principal):
            raise DraftException('Cannot retract content.')

        container = queryMultiAdapter((principal, self), IDraftContainer)
        if container is None:
            raise DraftException('Cannot find draft container.')

        content = self.context

        origName = content.__name__
        oldContainer = content.__parent__

        newName = INameChooser(container).chooseName(u'', content)

        container[newName] = removeAllProxies(content)
        del removeAllProxies(oldContainer)[origName]

        draft = container[newName]
        event.notify(ObjectRetractedEvent(content, draft))

        return draft
开发者ID:Zojax,项目名称:zojax.content.draft,代码行数:25,代码来源:contenttype.py

示例5: generateMessageId

 def generateMessageId(self, post, salt=None):
     ids = getUtility(IIntIds)
     post = ids.getId(removeAllProxies(post))
     if salt:
         if not isinstance(salt, basestring):
             salt = str(ids.getId(removeAllProxies(salt)))
         return '<%s.%[email protected]>'%(post, salt)
     else:
         return '<%[email protected]>'%post
开发者ID:Zojax,项目名称:zojax.blogger,代码行数:9,代码来源:destination.py

示例6: getMailInDestination

def getMailInDestination(context):
    annotation = IAnnotations(removeAllProxies(context))

    destination = annotation.get(KEY)
    if destination is None:
        destination = MailInAwareDestination(removeAllProxies(context))
        annotation[KEY] = destination

    return destination
开发者ID:Zojax,项目名称:zojax.mailin,代码行数:9,代码来源:mailinaware.py

示例7: __call__

    def __call__(self):
        context = self.context
        removeAllProxies(context)._v_currentRevision = -1

        rendered = super(WorkingRevision, self).__call__()

        removeAllProxies(context)._v_currentRevision = None

        return rendered
开发者ID:Zojax,项目名称:zojax.content.revision,代码行数:9,代码来源:working.py

示例8: getContent

    def getContent(self):
        content = self.wizard.getContent()
        data = removeAllProxies(content.getFieldData())

        for schema in (removeAllProxies(content).__schema__, IField):
            for name in getFieldNames(schema):
                field = schema[name].bind(content)
                data[name] = field.get(content)

        return data
开发者ID:Zojax,项目名称:zojax.persistent.fields,代码行数:10,代码来源:field.py

示例9: __call__

    def __call__(self):
        revid = int(self.context.__name__)
        content = self.context.__parent__.__parent__

        if checkPermission('zojax.ModifyContent', content):
            removeAllProxies(content).setRevision(revid)
            IStatusMessage(self.request).add(
                _('Revision has been activated.'))

        self.redirect('../')
开发者ID:Zojax,项目名称:zojax.content.revision,代码行数:10,代码来源:revision.py

示例10: install

    def install(self):
        ws = self.space.get(self.name)

        if not IMessagesWorkspace.providedBy(ws):
            ws = MessagesWorkspace(self.space.principalId)
            event.notify(ObjectCreatedEvent(ws))
            removeAllProxies(self.space)[self.name] = ws
            ws.__name__ = self.name
            ws.__parent__ = removeAllProxies(self.space)

        return ws
开发者ID:Zojax,项目名称:zojax.personal.messages,代码行数:11,代码来源:workspace.py

示例11: __init__

    def __init__(self, record, default=None):
        values = []
        ids = getUtility(IIntIds)

        context = removeAllProxies(record.object)
        while context is not None:
            values.append(ids.queryId(context))

            context = removeAllProxies(
                getattr(context, '__parent__', None))

        self.value = values
开发者ID:Zojax,项目名称:zojax.activity,代码行数:12,代码来源:catalog.py

示例12: search

    def search(self, object=None, contexts=(),
               sort_on='date', sort_order='reverse',
               noSecurityChecks=False, **kw):

        ids = getUtility(IIntIds)

        query = dict(kw)

        # records for object
        if type(object) is not type({}) and object is not None:
            oid = ids.queryId(removeAllProxies(object))
            if oid is None:
                return ResultSet(IFBTree(), getUtility(IActivity))

            query['object'] = {'any_of': (oid,)}

        # context
        if not contexts:
            contexts = (getSite(),)

        c = []
        for context in contexts:
            id = ids.queryId(removeAllProxies(context))
            if id is not None:
                c.append(id)

        query['contexts'] = {'any_of': c}

        # security
        if not noSecurityChecks:
            request = getRequest()
            if request is not None:
                users = listAllowedRoles(request.principal, getSite())
                if 'zope.Anonymous' not in users:
                    users.append('zope.Anonymous')

                query['allowedUsers'] = {'any_of': users}

        # apply searh terms
        results = self.apply(query)
        if results is None:
            results = IFBTree()

        # sort result by index
        if sort_on and sort_on in self:
            sortable = ISortable(self[sort_on], None)
            if sortable is not None:
                results = sortable.sort(results)

        if sort_order == 'reverse':
            return ReverseResultSet(results, getUtility(IActivity))
        else:
            return ResultSet(results, getUtility(IActivity))
开发者ID:Zojax,项目名称:zojax.activity,代码行数:53,代码来源:catalog.py

示例13: completeTask

    def completeTask(self):
        results = getUtility(ICatalog).searchResults(
            type={'any_of': ('project.task',),},
            projectTaskState = {'any_of': (1,)},
            projectTaskMilestone = {'any_of': (getUtility(IIntIds).getId(self),)},
            searchContext = self.__parent__.__parent__)

        for task in results:
            removeAllProxies(task).completeTask()
            event.notify(ObjectModifiedEvent(task))

        self.state = 2
        event.notify(StateChangedEvent(self, 2))
开发者ID:Zojax,项目名称:zojax.project,代码行数:13,代码来源:milestone.py

示例14: search

    def search(self, content=None,
               contexts=(), sort_on='date', sort_order='reverse', types=(), approved=()):
        ids = getUtility(IIntIds)
        indexes = list(self.values())

        query = {}

        # comments for content
        if content:
            query['content'] = {'any_of':(ids.getId(removeAllProxies(content)),)}

        # context
        if contexts:
            c = []
            for context in contexts:
                id = ids.queryId(removeAllProxies(context))
                if id is not None:
                    c.append(id)

            query['contexts'] = {'any_of': c}

        # content type
        if types:
            query['type'] = {'any_of': types}

        # security
        users = listAllowedRoles(getRequest().principal, getSite())
        if 'zope.Anonymous' not in users:
            users.append('zope.Anonymous')

        query['access'] = {'any_of': users}

        # comments approved
        if approved:
            query['approved'] = {'any_of': approved}

        # apply searh terms
        results = self.apply(query)
        if results is None:
            results = IFBTree()

        # sort result by index
        if sort_on and sort_on in self:
            sortable = ISortable(self[sort_on], None)
            if sortable is not None:
                results = sortable.sort(results)

        if sort_order == 'reverse':
            return ReverseResultSet(results, ids)
        else:
            return ResultSet(results, ids)
开发者ID:Zojax,项目名称:zojax.content.discussion,代码行数:51,代码来源:catalog.py

示例15: publishTraverse

    def publishTraverse(self, request, name):
        view = queryMultiAdapter((self.context, request), name=name)
        if view is not None:
            return view

        tasks = self.context.__parent__.__parent__.get('tasks')
        if tasks is not None:
            task = tasks.get(name)
            if task is not None:
                id = getUtility(IIntIds).getId(removeAllProxies(self.context))
                if task.milestone == id:
                    return LocationProxy(
                        removeAllProxies(task), self.context, name)

        raise NotFound(self.context, name, request)
开发者ID:Zojax,项目名称:zojax.project,代码行数:15,代码来源:milestone.py


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