[Zope-dev] "Problem" using External Method

Espen Sorbye Frederiksen ceeesf@cee.hw.ac.uk
Wed, 24 Jan 2001 15:58:43 +0000 (GMT)


> Take out all the "import __main__" statements and you should be fine.
>
> Python lets you access two namespaces at once: the "local" namespace and
> the "global" namespace.  Were it not for the global namespace, you would
> need to do something like "import __main__".  But since globals are
> there, everything available at the module level is also available at the
> function level.
>
> Shane

I did what you suggested, but I am still a bit stuck. Maybe I call them
wrong in my code. I use the call below but get an error.

<dtml-call expr="createdata('test1','test2','test3')">
<dtml-var expr="returndata()">

Error Type: AttributeError
Error Value: data

any suggestions what I do wrong,

Espen


>
> > class Testclass:
> >     def setdata(self,val1,val2,val3):
> >         self.data = [val1,val2,val3]
> >     def updatedata(self, index):
> >         self.data[index] = self.data[index]+1
> >     def display(self):
> >         return self.data
> >
> > x = Testclass()
> >
> > def createdata(var1, var2, var3):
> >     x.setdata(var1, var2, var3)
> >
> > def update(index):
> >     x.updatedata(index)
> >
> > def returndata():
> >     return x.display()
>
> _______________________________________________
> Zope-Dev maillist  -  Zope-Dev@zope.org
> http://lists.zope.org/mailman/listinfo/zope-dev
> **  No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope )
>
>