[Zope] Regarding ZODB

Ross Patterson me at rpatterson.net
Wed Mar 25 19:13:42 EDT 2009


amol kumbhar <amol.kumbhar39 at gmail.com>
writes:

> I am trying to execute following code
>
> import ZODB
> from Persistence import Persistent
>
> class Employee(Persistent):
>
>     def setName(self, name):
>         self.name = name
>
> but getting following error
>
> Error Type: ImportError
> Error Value: import of "Persistent" from "Persistence" is unauthorized. You are
> not allowed to access 'Persistent' in this context

It looks like you're trying to do this from a python script in the ZMI.
I think to do what you're trying to do you need to write a python
package on the filesystem.

Ross

> this is my full error log
>
> Time         2009/03/24 22:31:33.559 GMT+0530                                     
> User Name    admin (admin)                                                        
> (User Id)                                                                         
> Request URL  http://localhost:9673/DeveloperGuide/SimpleinterfaceException    ImportError                                                          
> Type                                                                              
> Exception    import of "Persistent" from "Persistence" is unauthorized. You are   
> Value        not allowed to access 'Persistent' in this context                   
>
> Traceback (innermost last):
>
>   • Module ZPublisher.Publish, line 119, in publish
>   • Module ZPublisher.mapply, line 88, in mapply
>   • Module ZPublisher.Publish, line 42, in call_object
>   • Module Shared.DC.Scripts.Bindings, line 313, in __call__
>   • Module Shared.DC.Scripts.Bindings, line 350, in _bindAndExec
>   • Module Products.PythonScripts.PythonScript, line 327, in _exec
>   • Module None, line 2, in Simpleinterface
>     <PythonScript at /DeveloperGuide/Simpleinterface>
>     Line 2
>   • Module AccessControl.ZopeGuards, line 284, in guarded_import
>
> ImportError: import of "Persistent" from "Persistence" is unauthorized. You are
> not allowed to access 'Persistent' in this context
>
> Display traceback as text
>
>   Return to log  
> REQUEST
>
> form
>
> -C ''
>
> cookies
>
> dtpref_rows '20'                                                                                                                               
> dtpref_cols '90%'                                                                                                                              
> tree-s      'eJzT0MgpMOQKVneEA1dbda4CI67EkgJjLj0AeGcHew'                                                                                       
> GLog        '%7Bleft%3A0%2Ctop%3A0%2Cwidth%3A1175%2Cheight%3A630%2CpriorityDefaults%3A%7BLog%3A4%7D%2CdefaultPriority%3A3%2CtrackRPC%3Anull%7D'
>
> lazy items
>
> SESSION <bound method SessionDataManager.getSessionData of <SessionDataManager at 
>         /session_data_manager>>                                                   
>
> other
>
> TraversalRequestNameStack []                                                    
> AUTHENTICATED_USER        <User 'admin'>                                        
> URL                       'http://localhost:9673/DeveloperGuide/Simpleinterface'
> SERVER_URL                'http://localhost:9673'                               
> AUTHENTICATION_PATH       ''                                                    
> traverse_subpath          []                                                    
> PUBLISHED                 <PythonScript at /DeveloperGuide/Simpleinterface>     
> ACTUAL_URL                'http://localhost:9673/DeveloperGuide/Simpleinterface'
> URL0                      http://localhost:9673/DeveloperGuide/SimpleinterfaceURL1                      http://localhost:9673/DeveloperGuideURL2                      http://localhost:9673BASE0                     http://localhost:9673BASE1                     http://localhost:9673BASE2                     http://localhost:9673/DeveloperGuideBASE3                     http://localhost:9673/DeveloperGuide/Simpleinterface  
>
> environ
>
> HTTP_COOKIE           'dtpref_rows="20"; dtpref_cols="90%"; GLog=                                                                                       
>                       %7Bleft%3A0%2Ctop%3A0%2Cwidth%3A1175%2Cheight%3A630%2CpriorityDefaults%3A%7BLog%3A4%7D%2CdefaultPriority%3A3%2CtrackRPC%3Anull%7D;
>                       tree-s="eJzT0MgpMOQKVneEA1dbda4CI67EkgJjLj0AeGcHew"'                                                                              
> SERVER_SOFTWARE       'Zope/(Zope 2.10.5-final, python 2.4.5, linux2) ZServer/1.1'                                                                      
> SCRIPT_NAME           ''                                                                                                                                
> REQUEST_METHOD        'GET'                                                                                                                             
> PATH_INFO             '/DeveloperGuide/Simpleinterface'                                                                                                 
> SERVER_PROTOCOL       'HTTP/1.1'                                                                                                                        
> channel.creation_time 1237914020                                                                                                                        
> CONNECTION_TYPE       'keep-alive'                                                                                                                      
> HTTP_ACCEPT_CHARSET   'ISO-8859-1,utf-8;q=0.7,*;q=0.7'                                                                                                  
> HTTP_USER_AGENT       'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.7) Gecko/2009030422 Ubuntu/8.04                                                 
>                       (hardy) Firefox/3.0.7'                                                                                                            
> HTTP_REFERER          'http://localhost:9673/DeveloperGuide/Simpleinterface/ZPythonScriptHTML_editForm'                                                 
> SERVER_NAME           '0.0.0.0'                                                                                                                         
> REMOTE_ADDR           '127.0.0.1'                                                                                                                       
> PATH_TRANSLATED       '/DeveloperGuide/Simpleinterface'                                                                                                 
> SERVER_PORT           '9673'                                                                                                                            
> HTTP_HOST             'localhost:9673'                                                                                                                  
> HTTP_ACCEPT           'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'                                                                 
> GATEWAY_INTERFACE     'CGI/1.1'                                                                                                                         
> HTTP_ACCEPT_LANGUAGE  'en-us,en;q=0.5'                                                                                                                  
> HTTP_ACCEPT_ENCODING  'gzip,deflate'                                                                                                                    
> HTTP_KEEP_ALIVE       '300'                                                                                                                             
>
> I think I have to change permissions, but the question is from WHERE please help
> me out..
>
> Thanks,
> Amol
>
> _______________________________________________
> Zope maillist  -  Zope at 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 )



More information about the Zope mailing list