[Zope] Py Classes in Python Script?

Gerrie Roos gerrie@trispen.com
Tue, 29 May 2001 16:03:24 +0200


I've read the 'How-To: Some Neat Tricks with dtml-tree' on www.zope.org and came accross the part:

class _dummy:
                            def __init__(self, name):
                                self.name=name

...and this is exactly what I need to implement at this stage to make my Python Script work in my dtml-tree...

But, alas, it seems (like the author pointed out in a note to himself) one cannot put this piece of code in a Zope Python Script...So
where to put it?  I need it only for this one instance.

Or how else can I pass results back to dtml-tree correctly?  As far as I could figure, dtml-tree has to receive a list of objects, and
these objects need attributes (eg. name) that can then be used for dtml-tree's id parameter, and also to use within your dtml-tree
block in dtml-var tags.

And how does this all relate to the results object returned from a ZSQL object?  Is there maybe a similar object that I can just
instantiate with all my data, and return it?  I looked at the Shared.DC.ZRDB.Results class, but it seemed a bit of a clumsy way to do
it...actually my python is not good.  I'm new, okay.

tnx
gerrie