Well I've had a look through the TG code and the FE code and the TG
code is different to the FE code.

The TG code only checks to see if the filename is blank and if it is
raises an error:

150     class FieldStorageUploadConverter(FancyValidator):
151         def to_python(self, value, state=None):
152             if isinstance(value, cgi.FieldStorage):
153                 if value.filename:
154                     return value
155                 raise Invalid('invalid', value, state)
156             else:
157                 return value

It either raises a missing filename error or returns the value
unmodified.  Therefore the easiest thing to do is just not use a
validator, because the validator isn't doing anything.

The original FE validator does seem to attempt to apply a conversion,
but doesn't seem to be needed:

1414 class FieldStorageUploadConverter(FancyValidator):
...
1421    def _to_python(self, value, state):
1422        if isinstance(value, cgi.FieldStorage):
1423            return fieldstorage.convert_fieldstorage(value)
1424        else:
1425            return value

Ed

On 7/13/06, Kevin Dangoor <[EMAIL PROTECTED]> wrote:
>
> On Jul 12, 2006, at 7:07 AM, Ed Singleton wrote:
>
> > That didn't work either.  I had a look through the FE documentation,
> > and saw what you meant.
> >
> > I'm not sure where to go from here, particularly as the
> > FieldStorageUploadConverter doesn't appear to have an error message of
> > "invalid".
>
> Actually, it does:
>
> http://trac.turbogears.org/turbogears/browser/trunk/turbogears/
> validators.py#L150
>
> Kevin
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to