[Zope] Creating PythonMethod from ZClass constructor/method.

Brian Lloyd Brian@digicool.com
Thu, 29 Jun 2000 11:02:17 -0400


> 
> Using Zope 2.2b3, I am trying to create a PythonMethod from the
> constructor of my ZClass and keep getting an authorization 
> dialog. In my
> MyZClass_add method, I have:
> 
>   <dtml-with "MyZClass.createInObjectManager(...)">
>       <dtml-call "manage_addFolder(id='testFolder')"> <!-- works! -->
>       <dtml-with "manage_addProduct['PythonMethod']">
>           <dtml-call "manage_addPythonMethod(
>               this(),
>               'testMethod',
>               'Test Method',
>               'self',
>               'pass'
>           )">
>       </dtml-with>
>   </dtml-with>
> 
> Every pemutation I have tried gives the same result: an Unauthorized
> exception.

Hi Jeff - 

Thanks for reporting this. It turns out that there was a 
missing security assertion in the product dispatcher 
(manage_addProduct) that was causing this. The fix will 
be in b4. If you want to patch your install in the meantime,
edit lib/python/App/FactoryDispatcher.py and change:


class ProductDispatcher(Acquisition.Implicit):
    " "

    def __getitem__(self, name):
    ...

to:

class ProductDispatcher(Acquisition.Implicit):
    " "

    # Allow access to factory dispatchers
    __allow_access_to_unprotected_subobjects__=1

    def __getitem__(self, name):
    ...


Brian Lloyd        brian@digicool.com
Software Engineer  540.371.6909              
Digital Creations  http://www.digicool.com