I'm trying to send an image to the client, so i have this function in
my controller:

    def Photo_Test(self):
        from PIL import Image
        from StringIO import StringIO
        f=open("test.jpg","rb")
        data=f.read(1000000)
        response.headers["content-type"]="image/jpeg"
        response.write(data)
        return response

The test.jpg file is just a tiny test jpeg. When I run "paster serve --
reload development.ini" and go to the page that would execute this
function paster just quits, and the browser is left with an empty
page.

Running "paster shell" and then the command "app.get("/main/
Photo_Test")" results in the following traceback:

>>> app.get("/main/Photo_Test")
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/Paste-1.4.2-py2.5.egg/paste/fixture.py", line
209, in get
    return self.do_request(req, status=status)
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/Paste-1.4.2-py2.5.egg/paste/fixture.py", line
384, in do_request
    **req.environ)
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/Paste-1.4.2-py2.5.egg/paste/wsgilib.py", line
341, in raw_interactive
    app_iter = application(basic_environ, start_response)
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/Paste-1.4.2-py2.5.egg/paste/lint.py", line
170, in lint_app
    iterator = application(environ, start_response_wrapper)
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/Paste-1.4.2-py2.5.egg/paste/cascade.py", line
92, in __call__
    return self.apps[-1](environ, start_response)
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/Paste-1.4.2-py2.5.egg/paste/registry.py", line
355, in __call__
    reg.cleanup()
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/Paste-1.4.2-py2.5.egg/paste/registry.py", line
314, in cleanup
    stacked._pop_object(obj)
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/Paste-1.4.2-py2.5.egg/paste/registry.py", line
252, in _pop_object_restoration
    self._pop_object_orig(obj)
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/Paste-1.4.2-py2.5.egg/paste/registry.py", line
214, in _pop_object
    if obj:
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/Paste-1.4.2-py2.5.egg/paste/registry.py", line
163, in __nonzero__
    return bool(self._current_obj())
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/Paste-1.4.2-py2.5.egg/paste/registry.py", line
238, in _current_obj_restoration
    return self._current_obj_orig()
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/Paste-1.4.2-py2.5.egg/paste/registry.py", line
182, in _current_obj
    'thread' % self.____name__)
TypeError: No object (name: Response) has been registered for this
thread


--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to