[z3-five] Adaptation in untrusted code

Maciej Wisniowski maciej.wisniowski at coig.katowice.pl
Fri Nov 17 20:52:21 CET 2006


> Are they failing as checked in?
They're failing. I just meant that if somebody wants to see these
tests then they should be executed from Five/test directory.

I have no experience with test writing, so I didn't know how
do you prefer this kind of failing tests.

> Looks like nobody has given the appropriate permission to 'test_role_1_'
> on that object.
Ehm... you are right. I've missed this.

> That case says to me that your adapter factory needs to return your
> adapter object with an appropriate acquisition context -- otherwise, the
> security machinery's 'inContextOf' check will fail.
You mean something like that:
in zcml:
<adapter
 factory="Products.Five.tests.contentspaceadapters.CacheablePlusFactory"

and:

def CacheablePlusFactory(context):
    return CacheablePlus(context).__of__(context)

from Acquisition import Explicit

class CacheablePlus(Explicit):
    implements(ICacheablePlus)

    def __init__(self, context):
        self.context = context

    def testmethod(self):
        return 'OK'


seems to be working.

-- 
Maciej Wisniowski


More information about the z3-five mailing list