This one time, at band camp, Daniel Lyons wrote:
>This one's biting me also. I fixed it for the mean time by making a
>copy of FileUploadKeeper and changing these lines:

I forgot about this message :)

I made my own validator, to use instead of FileUploadKeeper:

class FileUploadValidator(validators.FancyValidator):
    def _to_python(self, value, state):
        if isinstance(value, cgi.FieldStorage):
            filename = value.filename
            content = value.value
        elif isinstance(value, str):
            filename = None
            content = value
        return dict(filename=filename,
                    content=content)

then in a Schema I have something like this:

class NewCFPSchema(BaseSchema):
    attachment = FileUploadValidator()
    ...

and the attachment dictionary gets the filename and content set correctly.
Still not sure why FileUploadKeeper didn't work, but this one's working well
for me now.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" 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/pylons-discuss
-~----------~----~----~----~------~----~------~--~---

Reply via email to