On Wed, Apr 29, 2009 at 12:19 AM, Wichert Akkerman <[email protected]> wrote:
>
> Previously Ben Bangert wrote:
>> On Apr 28, 2009, at 2:43 PM, Wichert Akkerman wrote:
>>
>> >If you decide to use zope.component a controller could be a named
>> >utility. You could then register it like so:
>> >
>> > class BaseController(object):
>> > """This is the standard Pylons base controller class."""
>> > implements(IPylonsController)
>> >
>> >
>> > class MyController(BaseController):
>> > """My very own controller."""
>> >
>> > registerUtility(MyController, name="my_controller")
>>
>> Yikes! :)
>
> Why the yikes? The only change for a Pylons user is adding a single line
> to register the controller. The interface that is used to manage the
> registrations can be hidden in the BaseController class and internal
> pylons logic - people may never need to know about it. This gives you a
> lot of extra flexbility and pluggability, at the expense of asking
> people to add a single line of code for each controller.
>
The real problem is that a page is a controller *and* one ore more
templates. If you want to write a real pluggable system you need to
allow to register both templates and controllers. You also need a
standard template (eg: site.mako or main_template in plone) to insert
the output of the plugged app to the right place.
That's why I said that wsgi is enough for me because you can already
do that with Deliverance or in a controller with lxm or pyquery.
def MyController(environ, start_response):
html = PyQuery(app(environ, start_response))
return render('/site.mako',
extra_vars={'column_one':str(html('#column_one')),
'main':str(html('#main'))})
> Wichert.
>
> --
> Wichert Akkerman <[email protected]> It is simple to make things.
> http://www.wiggy.net/ It is hard to make things simple.
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---