Please bear with me, since I am just getting started with Pyramid. I am having trouble understanding context and resource in Pyramid, with regards to URL Dispatch. I'm not quite sure what it means from the description in the documentation, context and resource is somewhat circular (to me).
- What is a resource in pyramid? Is it just what the url is trying to represent?
For example, if the url is
/organization/add_users, is the resource organization or users? - Is the context also organization in the example above?
Also,
- What exactly is a context object?
What is the context object supposed to contain? The example in the tutorial only has the ACL and has nothing in the init method.
class RootFactory(object): __acl__ = [(...some permissions...)] def __init__(self): passWhen an exception is thrown (Forbidden for instance) at what point exactly does the context change?
I can see the purpose of the changing context when there is something like a Forbidden error, but when doing something like validation, why should I throw an exception that is registered with a different view_callable, which renders to a different template, when I can simply render to a different template within the same view_callable instead of throwing the exception? (I saw a validation error example for add_view in the docs)