On Thu, 25 Aug 2005 04:36 am, Dieter Maurer wrote:
> Does your "addValue" have a "__name__" attribute with value "addValue"?

In py2.3 (at least) functions get a __name__ automatically:

Python 2.3.5 (#2, Mar 29 2005, 15:41:06)
[GCC 3.3.5 (Debian 1:3.3.5-8ubuntu2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> def foo():
...  pass
...
>>> foo.__name__
'foo'
>>>


> If so, you may want to analyse the "FactoryDispatcher" mentioned
> above.
>
> You get it (in an interactive interpreter) via
>
>     app.manage_addProduct[<your Product>]
>
> In its class, you should find your contructors as
> well as permission attributes of the form "<constructor_name>__roles__".
>
> Apparently, "addValues__roles__" is missing (for whatever reason).

The ProductContext is creating the attributes correctly on the Product's 
custom FactoryDispatcher class. The correct class is being used, and the 
*__roles__ attributes are all present and accounted for when the validate() 
is invoked. The problem appears to be that we don't even get up to checking 
those attributes. The addValues function has no __roles__ attribute, so we 
wander into __roles__ attribute checking on the container and fall about 
laughing. So I added __roles__ to addValues:

  addValues.__roles__ = ('Manager', )

and now everything works. I even removed the ModuleSecurityInfo declarations, 
since they appeared to have no effect at all. There's probably some API for 
setting that __roles__ attribute, but I'm stuffed if I can find it.


Thanks for the help Dieter,

     Richard

Attachment: pgpn3xLBQmglw.pgp
Description: PGP signature

_______________________________________________
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )

Reply via email to