wsgi example doesn't work for me: KeyError: 'paste.registry'

18 views
Skip to first unread message

Aaron Watters

unread,
Oct 29, 2009, 10:15:01 AM10/29/09
to ToscaWidgets-discuss
Hi folks.

I'd love to create WHIFF support for Tosca Widgets,
but I can't even get the example wsgi_app.py to work.

Traceback below. (I tried to add an issue to the Trac inteface,
posting here too just in case...)

Please help! Thanks! -- Aaron Watters
( http://whiff.sourceforge.net )

=== here is the traceback:

aaron:~/misc/tosca Aaron$ python wsgi_app.py
WebError is not available for debugging
Server started at http://127.0.0.1:8000/
[ I GET http://127.0.0.1:8000/ from FireFox and... ]
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/wsgiref/handlers.py", line 92, in run
self.result = application(self.environ, self.start_response)
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/wsgiref/validate.py", line 176, in lint_app
iterator = application(environ, start_response_wrapper)
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/ToscaWidgets-0.9.8-py2.5.egg/tw/core/
middleware.py", line 43, in __call__
return self.wsgi_app(environ, start_response)
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/ToscaWidgets-0.9.8-py2.5.egg/tw/core/
middleware.py", line 46, in wsgi_app
self.host_framework.start_request(environ)
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/ToscaWidgets-0.9.8-py2.5.egg/tw/mods/base.py",
line 97, in start_request
registry = environ['paste.registry']
KeyError: 'paste.registry'
localhost - - [29/Oct/2009 10:04:50] "GET / HTTP/1.1" 500 59

Diez B. Roggisch

unread,
Nov 2, 2009, 5:33:06 PM11/2/09
to toscawidge...@googlegroups.com
Aaron Watters schrieb:

> Hi folks.
>
> I'd love to create WHIFF support for Tosca Widgets,
> but I can't even get the example wsgi_app.py to work.
>
> Traceback below. (I tried to add an issue to the Trac inteface,
> posting here too just in case...)

Please don't do that unless it has been confirmed that it *is* a bug.

And it isn't. You need to add a RegistryManager to your
application-stack. Which you can do by passing

stack_registry=True

to the make_middleware call.


Diez

Aaron Watters

unread,
Nov 4, 2009, 7:36:08 AM11/4/09
to ToscaWidgets-discuss


On Nov 2, 5:33 pm, "Diez B. Roggisch" <de...@web.de> wrote:
> Aaron Watters schrieb:
> Please don't do that unless it has been confirmed that it *is* a bug.

I missed the documentation on the registry thing.
If if isn't documented, it's at least a documentation
bug imho. Thanks!
-- Aaron Watters

===
why does a giraffe have such a long neck?
because it's head is so far from its body.

Aaron Watters

unread,
Nov 4, 2009, 8:36:55 AM11/4/09
to ToscaWidgets-discuss
Here is the patch to your example application
which works after adding the keyword argument
like you said.

$ hg diff
diff -r 1c90a90eacbe examples/wsgi_app.py
--- a/examples/wsgi_app.py Sun Jun 01 12:10:32 2008 +0200
+++ b/examples/wsgi_app.py Wed Nov 04 08:30:05 2009 -0500
@@ -70,7 +70,7 @@
# c, h, session, request, etc... available at template namespace
'toscawidgets.framework': 'wsgi',
'toscawidgets.middleware.inject_resources': True,
- })
+ }, stack_registry=True)

# Used to validate TW's middleware WSGI compliance
app = validator(app)
Reply all
Reply to author
Forward
0 new messages