Skip to content
This repository has been archived by the owner on Nov 30, 2023. It is now read-only.

self.response.out.write(StateForm()) #2

Closed
GoogleCodeExporter opened this issue Feb 26, 2016 · 2 comments
Closed

self.response.out.write(StateForm()) #2

GoogleCodeExporter opened this issue Feb 26, 2016 · 2 comments

Comments

@GoogleCodeExporter
Copy link

With webapp, I can write out a form using self.response.out.write( form )

I can't with webapp-improved

    self.response.out.write(StateForm())
  File "/home/jamesd/python/google_appengine/lib/webob/webob/__init__.py", line 1613, in write
    self.body += text
TypeError: cannot concatenate 'str' and 'StateForm' objects

Original issue reported on code.google.com by JDeibele on 13 Aug 2010 at 6:12

@GoogleCodeExporter
Copy link
Author

Hi, 
Thanks for the report. For now you can add this method to Response:

    def write(self, text):
        """Appends a text to the response body."""
        # webapp uses StringIO as Response.out, so we need to convert anything
        # that is not str or unicode to string to keep same StringIO behavior.
        if not isinstance(text, basestring):
            text = str(text)

        super(Response, self).write(text)

It'll be included in the next release.

Original comment by rodrigo.moraes on 13 Aug 2010 at 8:28

@GoogleCodeExporter
Copy link
Author

This issue was closed by revision ac860e4927.

Original comment by rodrigo.moraes on 13 Aug 2010 at 8:45

  • Changed state: Fixed

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant