On Mon, Jul 12, 2010 at 11:45 AM, Guyren G Howe <[email protected]> wrote: > This is an app someone else started that I'm picking up. Whether or not I had > trouble with my restful route in a new project, it wouldn't tell me why it's > failing in this one.
OK, this is the most important point, and it would have been helpful if you had mentioned it at the beginning. Most of the questions we get are for new applications. > On Jul 12, 2010, at 9:17 , Graham Higgins 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')) > ) ErrorHandler is what produces the interactive traceback (if debug = true). StatusCodeRedirect produces fancy HTML error pages (instead of plain white pages). So you definitely need ErrorHandler for debugging. This 'make_middleware_with_config' function is nonstandard, perhaps based on a Repoze.who tutorial or third-party application template. In any case, somewhere under that function is the equivalent of middleware.py, and you would have to add the ErrorHandler middleware as shown in the docs. > Do I append the if asbool… stuff? Somehow merge it with what I've got? 'asbool' is not strictly necessary. It would be false only if you were nesting this Pylons application inside another Pylons application, which is a rare case. Just add the ErrorHandler line at the appropriate place where the application is instantiated. Guyren wrote: > On Jul 12, 2010, at 11:28 , Mike Orr wrote: > >>> - can anyone tell me from here what I've done wrong? >>> - (more importantly) how do I get more information than just "404"? >>> I've got all my logging set to debug in my config file. If this was >>> Rails, I'd have a detailed log being produced that tells me what >>> controller it was going to, what arguments it received, and so on. All >>> my log in TG is giving me is the SQL being generated. What am I >>> missing? >> >> This is a TurboGears application with a REST controller? I'm afraid >> you're asking too many questions at once, plus I'm not sure exactly >> what you're seeing or whether the other parts of the application work. >> If there's any SQL activity, you wouldn't get a 404 because it would >> be past that point. > > And yet that's what I'm seeing. > > It's ignoring the map.resource and falling through to my "root" controller. > It's after that, that I get the 404. But it does a bunch of auth-related SQL > first. Repoze.who must be doing the auth queries in its own middleware. So ignore those and focus on the 404. Does any other part of the application work? Can you disable the authentication temporarily? What was the application's state when it was given to you? Did the other developer come across this 404 error and gave up fixing it? Or was it working earlier and then stopped working? > FWIW, the restful route call is the first one in the routing file. That matters only in the sense that it monopolizes "/things" URLs. -- 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.
