[Zope] Py Classes in Python Script?

Peter Bengtsson mail@peterbe.com
Tue, 29 May 2001 16:18:51 +0200


External Methods is the answer. The only answer where you can create py
classes and use them together with objects in zope.
----- Original Message -----
From: "Gerrie Roos" <gerrie@trispen.com>
To: <zope@zope.org>
Sent: Tuesday, May 29, 2001 4:03 PM
Subject: [Zope] Py Classes in Python Script?


> 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
>
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )