Re: [Zope] Migration pains going to Zope 2.8
On Thu, 25 Aug 2005 12:06 pm, Richard Jones wrote: > and now everything works. Further data-point - the version of VerboseSecurity is to blame. It's not 2.8-compatible :( Sorry for the noise. Richard pgpvvxmwsl89Y.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 )
Re: [Zope] Migration pains going to Zope 2.8
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[] > > In its class, you should find your contructors as > well as permission attributes of the form "__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 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 )
Re: [Zope] Migration pains going to Zope 2.8
Richard Jones wrote at 2005-8-24 16:11 +1000: >I can't instantiate out Product, which is a bit of a hurdle :) > >Our Product's registration looks like this (this function is invoked from the >Product's __init__.py): > >def initialize(context): >''' Register the CGPublisher class ''' >context.registerClass( >CGPublisher, >permission=Perm.ADD_CGPUBLISHERS, >constructors = (addCGPublisherForm, addCGPublisher, addValues, >getMode), >icon='www/CGPublisher.gif', >visibility='Global', >) > >Unfortunately, the addCGPublisherForm template can't access the "addValues" >function. The specific error I get is: > > Error Type: Unauthorized > Error Value: The container has no security assertions. Access to 'addValues' > of (App.ProductContext.__FactoryDispatcher__ object at 0xb61d30cc) denied. Maybe, you do not honor the following requirement (documented in "App.ProductContext.ProductContext.registerClass"): constructors -- A list of constructor methods A method can me a callable object with a __name__ attribute giving the name the method should have in the product, or the method may be a tuple consisting of a name and a callable object. The method must be picklable. The first method will be used as the initial method called when creating an object. Does your "addValue" have a "__name__" attribute with value "addValue"? If so, you may want to analyse the "FactoryDispatcher" mentioned above. You get it (in an interactive interpreter) via app.manage_addProduct[] In its class, you should find your contructors as well as permission attributes of the form "__roles__". Apparently, "addValues__roles__" is missing (for whatever reason). -- Dieter ___ 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 )
[Zope] Migration pains going to Zope 2.8
I can't instantiate out Product, which is a bit of a hurdle :) Our Product's registration looks like this (this function is invoked from the Product's __init__.py): def initialize(context): ''' Register the CGPublisher class ''' context.registerClass( CGPublisher, permission=Perm.ADD_CGPUBLISHERS, constructors = (addCGPublisherForm, addCGPublisher, addValues, getMode), icon='www/CGPublisher.gif', visibility='Global', ) Unfortunately, the addCGPublisherForm template can't access the "addValues" function. The specific error I get is: Error Type: Unauthorized Error Value: The container has no security assertions. Access to 'addValues' of (App.ProductContext.__FactoryDispatcher__ object at 0xb61d30cc) denied. I tried adding some module security declarations: security = ModuleSecurityInfo('Products') security.declarePublic('CGPublisher') security = ModuleSecurityInfo('Products.CGPublisher') security.declarePublic('addValues') security.declarePublic('getMode') to the initialize() function, but that didn't change anything. Any suggestions? pgpHifT3MDPM9.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 )