OK, I am getting desperate here. I cannot figure out what is in the namespace from within an external method. I have an external method that uses the re module, and when I execute it from the dtml, I get AttributeError, value: __len__. If I execute the same external method from the constructor of the ZClass, instead of from inside the ZClass, it runs perfectly. How can I get the namespace of the external method to include all of python's normally accessible modules? --sam
Hi, An external method is standard (unrestricted) python. What you're describing sounds like you're trying to get the length of some object that has no __len__ method defined (and therefore, no concept of length). Generally, the first parameter in an external method is self, and you can get to things in the ZODB via self (self.MyZODBObj, etc.). Python builtins like len() should just work, and you can freely import other modules for use. You may want to double check that you're not calling len() on something that has no len... Kevin ----- Original Message ----- From: "Sam Gendler" <sgendler@teknolojix.com> To: <zope@zope.org> Sent: Tuesday, November 30, 1999 6:03 PM Subject: [Zope] PLEASE HELP ME!!!!
OK, I am getting desperate here.
I cannot figure out what is in the namespace from within an external method.
I have an external method that uses the re module, and when I execute it from the dtml, I get AttributeError, value: __len__. If I execute the same external method from the constructor of the ZClass, instead of from inside the ZClass, it runs perfectly. How can I get the namespace of the external method to include all of python's normally accessible modules?
--sam
_______________________________________________ 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 )
participants (2)
-
Kevin Dangoor -
Sam Gendler