On 12/1/05, Fernando Lujan <[EMAIL PROTECTED]> wrote: > There's a way to use a Python class inside zope? > > For instance, if I create the class: > > class MyClass: > "A simple example class" > i = 12345 > def f(self): > return 'hello world' > > Can I invoke the following code inside a Python Script? > > x = MyClass() > x.f()
Any Python code can be used from a Python Script, as long as it has been marked safe for importing into a restricted code. So, yes, you can define your Python class in a Product, but you must mark it safe for use in scripts. You can then import your code into the script and use it there. In lib/python/Products/PythonScripts/module_access_examples.py you'll find a series of examples that explain how to mark code safe for use in restricted code. Martijn Pieters _______________________________________________ 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 )