There seems to be a bug in the way parameters are referenced in python scripts. I have a simple script that has a list as a default parameter. The script then appends something to this list and returns the list. Each time I call the script the list gets to be one element longer. Here is an example script:
## Script (Python) "pyFix" ##bind container=container ##bind context=context ##bind namespace= ##bind script=script ##bind subpath=traverse_subpath ##parameters=a=['a'] ##title= ## a.append('b') return a
The output from the script is as follows: 1st call: ['a','b'] 2nd call: ['a','b','b'] 3rd call: ['a','b','b','b'] 4th call: ['a','b','b','b','b'] etc.
It seems that I'm getting a reference to the default parameter which I then modify for future calls. Currently I'm getting around this by having list parameters default to none and then setting the defaults within the script.
I have some security concerns since I can change the default parameters for other users on the server. Or so it seems.
Suggestions?
Brian Brinegar Engineering Computer Network Purdue University
_______________________________________________
Zope-Dev maillist - [EMAIL PROTECTED]
http://mail.zope.org/mailman/listinfo/zope-dev
** No cross posts or HTML encoding! **
(Related lists - http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope )