Re: Colander: unflatten invalid.asdict() error

2012-05-08 Thread Robert Forkel
you may want to have a look at cornice [1]. Among other things it helps with validating json input via colander and handling resulting errors. regards, robert [1] http://cornice.readthedocs.org/en/latest/index.html On Wed, May 9, 2012 at 3:52 AM, anh le wrote: > Hi all, > > I'm using colander to

Re: Default template variables

2012-05-08 Thread Robert Forkel
If you are using mako, you may want to have a look at http://docs.makotemplates.org/en/latest/runtime.html#context-variables and adapt the strict_undefined setting in your config. regards robert On Wed, May 9, 2012 at 6:27 AM, Theron Luhn wrote: > I can pass variables into my template by returnin

Default template variables

2012-05-08 Thread Theron Luhn
I can pass variables into my template by returning them in a dictionary from the view controller. However, if I try to access a variable from the template that I didn't pass, I'll get an error. Is it possible to have a default value so I don't get an error? Maybe with BeforeRender or something? -

Colander: unflatten invalid.asdict() error

2012-05-08 Thread anh le
Hi all, I'm using colander to validate json input for my api. To report the invalid input to user I try to unflatten the invalid.asdict() However if the invalid input located in the place other than the first place in a sequence the unflatten fails. Here is the snipets: (as https://gist.github

Re: Django-like Error Handling

2012-05-08 Thread Brian Morgan
Chris, Thanks for taking time to answer my question. It's much appreciated. -Brian On Tuesday, May 8, 2012 3:05:40 PM UTC-5, Chris Lambacher wrote: > > You can either make it conditionally added using config.add_view in your > main function: > > from pyramid.config import Configurator > from p

Re: Django-like Error Handling

2012-05-08 Thread Chris Lambacher
You can either make it conditionally added using config.add_view in your main function: from pyramid.config import Configurator from pyramid.settings import asbool def main(global_config, **settings): config = Configurator(settings=settings) if asbool(settings.get('show_friendly_error_page)

Django-like Error Handling

2012-05-08 Thread Brian Morgan
Please forgive me if this is documented somewhere or has been asked and answered before. I've been searching but haven't been able to find an answer. How do I get django-like error handling with Pyramid, where I can debug exceptions with the pyramid debugtoolbar during development, and in prod

Re: Mixing data and interface in RESTful app

2012-05-08 Thread Jasper
I don't think its short-sighted, in fact I use this approach, and it fits very nicely with traversal. Having a static versioned API is not a necessity. You only break the (RESTful) API when you remove members from your resources. If you plan to do this you can always warn your clients in time. B