[Zope] Python: methods arguments limited to 256?
Andy McKay
andy at clearwind.ca
Thu Apr 15 16:09:17 EDT 2004
Julio Silva wrote:
> Well... we could start a thread on that matter but we dont have time, I
> find some real exceptional cases in my programming life, specialy in my
> glueware legacyware programming.
> Suppose you use zope to migrate legacy databases and suppose you find
> yourself with a legacy table with 400 fields, there you must start your
> brain in high creative mode and with default value infinite on patience
> variable :-)
Agreed, but there's still better ways to go, pass through a struct or
object that contains the variables and access them in DTML ;)
> Thanks for you help Andy, but I'm positive certain by the debug I'm
> making that if I pass 255 parameters its ok, once I pass the 256th the
> error begin to arise, I have measures to certify there
> is no character encode problem, that was the first thing I checked.
> Make this test: create a python script and copy the code below into it
> and try to "save changes"
> you get the error. take out one parameter and hit "save changes" again
> you will be able to save the document with no errors.
Ah I was doing something slightly different in my test.
I'll still say its a real edge case that does not need fixing, however
the error message for a Python Script could be clearer.
Anyway use *, and **... Here's my test case that passes in over 500
arguments into a Python Script and it works just fine.
args = []
for x in range(256):
args.append("%sx")
kw = {}
for x in range(256):
kw["%sx" % x] = x
container.someMethod(*args, **kw)
print len(args), len(kw)
return printed
And that works fine ;)
--
Andy McKay
ClearWind Consulting
http://www.clearwind.ca
More information about the Zope
mailing list