[Zope] Newbie question on passing arguments

Dieter Maurer dieter@handshake.de
Sun, 21 Apr 2002 09:44:21 +0200


Rengasamy, Samy writes:
 > I have a DTML Method:
 > 	<dtml-let webUrl="getRelativePath(rel=absolute_url(relative=1),
 > ip=hostIP)">
 > 
 > calling a script:
 > 	def getRelativePath(rel, ip):
 > 	    weburl = ip + rel 
 > 	    return weburl
 > 
 > And getting the following error:
 > 	Zope ErrorZope has encountered an error while publishing this
 > resource.
 > 	Error Type: Type Error
 > 	Error Value: getRelativePath() takes no arguments (2 given)
 > 
 > What am I missing here...?
You did not get your script but the object's method of the same name.

You can use my "DocFinder" product

  <http://www.dieter.handshake.de/pyprojects/zope/book/chap3.html>

to find out what methods an object has and avoid their names.

Maybe, a better approach is to use consistent prefixes or suffixes
for your own utility functions (such as "myGetRelativePath") to
make name clashes unlikely without initial investigation.


Dieter