[z3-five] can't import an interface into a page template
Tim Hicks
tim at sitefusion.co.uk
Wed Nov 17 17:49:15 MET 2004
Florent Guillaume said:
>> Unauthorized: The container has no security assertions. Access to
>> 'setFlag' of (Products.atemail.flags.FlagStorage object at 0x41c5034c)
>> denied.
>>
>>
>> I have a feeling this is because despite having Implicit as a base
>> class,
>> my adapter doesn't have an acquisition path back to the zope root
>> object.
>
> Probably. You could try to have your adapter for IMessageFlags return a
> wrapped version of the object if you can get hold of some persistent
> object under the appropriate user folder. This could work:
> root = Zope.app()
> # or any suitable persistent object you may have lying around
> return flagstorage.__of__(root)
> FlagStorage has to inherit from Implicit for this to work.
That seems like a good idea, except that I don't know how I could actually
implement it. I'm creating the adapter from zpt code, so I can't use
__of__ there. To create the adapter, I am calling the interface, so to
affect anything there, I guess I'd have to patch the __call__ method of
interfaces (which I don't want to do). The file system code that I
currently have involved in all this is the adapter itself, but I don't
know quite how to fit in the adapter.__of__(context) pattern into that
code.
> Or you could try for FlagStorage to directly have a security assertion
> like setDefaultAccess('allow').
I just tried this and it does indeed work (thanks). Only problem is that
it is a bit of a security whole. It'll do me for now, but I guess I'm
hoping some bright spark comes up with a better way of doing things in the
future.
Seems like what I really want is zope3 views to work with archetypes...
thanks all,
tim
More information about the z3-five
mailing list