Hi all,

Using turbogears with the uploadbar example from:
http://docs.turbogears.org/1.0/FileUploadProgressBar
I realize that when i post some information that raise an error (For
example invalid form value entered), turbogears crash. I lost the
trace exception but it was something like:

(... )
  File "/usr/lib/python2.5/site-packages/turbogears/controllers.py,
line 509, in url
     args.append("%s=%s" % (key, urllib.quote(str(value))))
  File "/usr/lib/python2.5/cgi.py", line 541, in __repr__
    self.name, self.filename, self.value)
  File "/usr/lib/python2.5/cgi.py", line 551, in __getattr__
    value = self.file.read()
TypeError: read() takes exactly 2 arguments (1 given)


Looking at controllers.py; lines 504 to 509 looks like:

     for key, value in tgparams.iteritems():
-        if value is None:
             continue
         if isinstance(value, unicode):
             value = value.encode("utf8")

I think we don't want to include file info, so i changed to:

     for key, value in tgparams.iteritems():
+        if value is None or isinstance(value, cgi.FieldStorage):
             continue
         if isinstance(value, unicode):
             value = value.encode("ut

And it's working now. I can attach the patch if it is approved.


Regards,
Martin Conte Mac Donell.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to