[Zope] Is there such a method as PythonScript()
Johan Carlsson
johanc at easypublisher.com
Sat Sep 11 03:56:15 EDT 2004
Bill Hewitt wrote:
> I there a method called PythonScript() that works like DTMLFile()?
>
> IF so, how does one use it?
>
> How about ZSQLMethod()?
>
> I would like to include ZSQLMethods and PythonScripts as methods in my
> python Class.....
PythonScripts are generally not necessary to use when you
write a Python Product, because you can write Python methods
directly on your class.
The way Python methods work is a bit diffrent from Python Scripts,
for one thing you don't have context variables (context, container,
etc.). But on the other hand you arn't required to use restricted
code, which means the full power of Zope (read more about writing
Python Products in the Zope book :-)
ZSQLMethods can't be used in Python Products, but...
I've written a Product that let's you do just that.
I've uploaded it at::
http://zope.org/Members/johanc/DCDSQL/DCDSQL-0-0-1-beta.tgz
The documentation is not that great but there is an example how to use
it in the readme.txt.
Basically a connection object is created on module level and ZSQL
Methods are created in the class code (no external file).
The Methods can take a "brain" class as an argument, the brain class
is used to wrap the object in the result that the methods returns,
allowing you to add methods and attributes to the result objects.
(Well it's not a new feature but it's really useful in the context
of Python Products.)
Any questions, send them to zope at zope.org. I really would like others
to review and improve the code :-)
Regards,
Johan
--
Johan Carlsson Tel: + 46 8 31 24 94
Colliberty Mob: + 46 70 558 25 24
Torsgatan 72 Email: johanc at easypublisher.com
SE-113 37 STOCKHOLM
More information about the Zope
mailing list