On Mon, Jul 12, 2010 at 2:50 PM, Guyren G Howe <[email protected]> wrote:
> On Jul 12, 2010, at 12:36 , Wyatt Baldwin wrote:
>
>>>> But this is Pylons, so not only do you have a detailed log, it is also an 
>>>> interactive debugger, allowing you to directly interrogate the app state:
>>>
>>>> http://pylonshq.com/docs/en/1.0/debugging/
>>>
>>> Thanks for the advice, but I'm still confused.
>>>
>>> The docs advise me to do this in my config/middleware.py:
>>>
>>> if asbool(full_stack):
>>>         # Handle Python exceptions
>>>         app = ErrorHandler(app, global_conf, **config['pylons.errorware'])
>>>         # Display error documents for 401, 403, 404 status codes (and
>>>         # 500 when debug is disabled)
>>>         if asbool(config['debug']):
>>>                 app = StatusCodeRedirect(app)
>>>                 else:
>>>                 app = StatusCodeRedirect(app, [400, 401, 403, 404, 500])
>>>
>>> I currently have this in my config/middleware.py:
>>>
>>>     app = make_middleware_with_config(
>>>         app,
>>>         global_conf,
>>>         who_config,
>>>         app_conf['who.log_file'],
>>>         app_conf['who.log_level'],
>>>         skip_authentication=asbool(app_conf.get('skip_authentication', 
>>> 'false'))
>>>     )
>>>
>>> Do I append the if asbool… stuff? Somehow merge it with what I've got?
>>
>> If the only thing that's in your middleware file is the who app, you
>> almost certainly want to add back at least the ErrorHandler
>> middleware. That's the middleware that brings up the Web based
>> debugger when you're in debug mode.
>
> I'm afraid I'm a little too new to Pylons to follow what you're saying there, 
> and I can't find where in the docs it has the answer, either (the only place 
> where it's described in any detail is one screenful showing one example in 
> <http://pylonshq.com/docs/en/1.0/configuration/#middleware-config>. Is there 
> documentation somewhere about what I can do in this file?
>
> In any event, how do I merge the two configs above? They are written rather 
> differently. Why is that? When do I use make_middleware_with_config, and when 
> do I use ErrorHandler?
>
> Most important, is all this stuff actually documented somewhere?

The stanza with ErrorHandler is a normal Pylons application.

'make_middleware_with_config' is a custom function as I said; it is
not standard Pylons. I believe it's a tradition when using Repoze.who,
but I can't analyze it beyond that. Perhaps a Repoze expert can.
Otherwise, what is the content of this function? Does it have an
import line containing a "make_app" function, something like "from
myapp.config.middleware import make_app"?  If so, ErrorHandler should
be in the make_app function.

If you can't find that, there must be some code that mimics make_app,
calling load_environment() and PylonsApp() the way the documented
function does.  Otherwise, I don't know how the Pylons application is
being created at all.

It's proably best if you post your make_middleware_with_config
function. You can put it in the pastebin at pylonshq.com and link to
it here.

I have to catch a bus now and won't be able to reply till later this evening.

-- 
Mike Orr <[email protected]>

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