Re: [Zope] Regarding ZODB

2009-03-25 Thread Ross Patterson
amol kumbhar 
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 Nameadmin (admin)
> 
> (User Id) 
> 
> Request URL  http://localhost:9673/DeveloperGuide/SimpleinterfaceException
> ImportError  
> Type  
> 
> Exceptionimport of "Persistent" from "Persistence" is unauthorized. You 
> are   
> Valuenot 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
> 
> 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   /session_data_manager>>   
> 
>
> other
>
> TraversalRequestNameStack []  
>   
> AUTHENTICATED_USER  
>   
> URL   
> 'http://localhost:9673/DeveloperGuide/Simpleinterface'
> SERVER_URL'http://localhost:9673' 
>   
> AUTHENTICATION_PATH   ''  
>   
> traverse_subpath  []  
>   
> PUBLISHED
>   
> 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

Re: [Zope] Regarding ZODB

2009-03-25 Thread Dieter Maurer
amol kumbhar wrote at 2009-3-25 10:28 +0530:
>I am trying to execute following code
>
>*import ZODB
>from Persistence import Persistent

For Zope 2.8, the package/module structure has been drastically changed.
What used to be in "Persistence" is now in "persistent".

I.e. you now use "from persistent import Persistent".



-- 
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] Regarding ZODB

2009-03-24 Thread amol kumbhar
Hi!

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*

this is my full error log


Time 2009/03/24 22:31:33.559 GMT+0530  User Name (User Id) admin
(admin)  Request
URL http://localhost:9673/DeveloperGuide/Simpleinterface  Exception Type
ImportError  Exception Value import of "Persistent" from "Persistence" is
unauthorized. You are 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
   **
   *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

  REQUEST form-C''cookiesdtpref_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
itemsSESSION>otherTraversalRequestNameStack
[]AUTHENTICATED_USERURL'
http://localhost:9673/DeveloperGuide/Simpleinterface'SERVER_URL'
http://localhost:9673'AUTHENTICATION_PATH''traverse_subpath[]PUBLISHEDACTUAL_URL'
http://localhost:9673/DeveloperGuide/Simpleinterface'URL0
http://localhost:9673/DeveloperGuide/SimpleinterfaceURL1
http://localhost:9673/DeveloperGuideURL2http://localhost:9673BASE0
http://localhost:9673BASE1http://localhost:9673BASE2
http://localhost:9673/DeveloperGuideBASE3
http://localhost:9673/DeveloperGuide/SimpleinterfaceenvironHTTP_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_time1237914020CONNECTION_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@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 )