An example of rolling your own controller class:

from project.lib import BaseController

class MyController(BaseController):
    def __init__(self, root, request):
        self.request = request
        # any other statements to be executed before every view

    def get_index(self):
        return {
            'global_obj':
self.request.registry.settings.get('some_global_obj')
        }

in your configuration:

config.add_view('project.controllers.MyController', attr='get_index',
method='GET')

If the view object is a class, then __init__ is called first, then
__call__ unless an attr arg is supplied to the view config. Does this
help you at all?

Jesse




On Feb 2, 12:39 pm, Jonathan Vanasco <jonat...@findmeon.com> wrote:
> On Feb 1, 3:19 pm, Mike Orr <sluggos...@gmail.com> wrote:
>
> > Actually, the closest thing to controllers is view classes.
> > pyramid_handlers is one way to manage view classes, but increasingly
> > people are "doing it themselves" with @view_config.
>
> Could you point me to something where someone "does it themselves"?
>
> Just wondering what the implementation would be.

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to pylons-discuss@googlegroups.com.
To unsubscribe from this group, send email to 
pylons-discuss+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.

Reply via email to