Replacing PylonsApp by TgApp?

0 views
Skip to first unread message

Gustavo Narea

unread,
Aug 8, 2008, 1:42:46 PM8/8/08
to turbogea...@googlegroups.com
Hello,

Please check this bug report first: http://trac.turbogears.org/ticket/1932

TG2-dev relies on a non-existing feature of Pylons: TG is supposed to support
custom paths for the controllers, but that's not possible because Pylons only
supports the traditional {mypackage}.controllers.

So I think there's only one option to solve this: Subclassing PylonsApp to
override find_controller()
<http://docs.pylonshq.com/modules/wsgiapp.html#pylons.wsgiapp.PylonsApp.find_controller>.

It'd be overridden so that if a custom controller patch is set, the parent
method is ignored.

I think it's a good moment to implement this, since we're still in alpha; this
will allow us to override more things in the future, if required. This would
not break existing TG2 applications, but I think TgApp (or whatever you
decide to reffer to this) should be used from now on instead of PylonsApp.

I can take care of this if you want.

Cheers.
--
Gustavo Narea.
General Secretary. GNU/Linux Matters.
http://www.gnulinuxmatters.org/

signature.asc

Alberto Valverde

unread,
Aug 8, 2008, 1:51:26 PM8/8/08
to turbogea...@googlegroups.com
Gustavo Narea wrote:
> Hello,
>
> Please check this bug report first: http://trac.turbogears.org/ticket/1932
>
> TG2-dev relies on a non-existing feature of Pylons: TG is supposed to support
> custom paths for the controllers, but that's not possible because Pylons only
> supports the traditional {mypackage}.controllers.
>
> So I think there's only one option to solve this: Subclassing PylonsApp to
> override find_controller()
> <http://docs.pylonshq.com/modules/wsgiapp.html#pylons.wsgiapp.PylonsApp.find_controller>.
>

I think it'll be better to propose it to the Pylons folks and send them
a patch so it is changed upstream in PylonsApp. It frankly surprises me
that this setting can't be changed since there's even a 'pylons.paths'
config key which suggests it should. I'm almost sure it is a bug.


> It'd be overridden so that if a custom controller patch is set, the parent
> method is ignored.
>
> I think it's a good moment to implement this, since we're still in alpha; this
> will allow us to override more things in the future, if required. This would
> not break existing TG2 applications, but I think TgApp (or whatever you
> decide to reffer to this) should be used from now on instead of PylonsApp.
>
> I can take care of this if you want.
>

Yes, please :)

Alberto

Gustavo Narea

unread,
Aug 8, 2008, 1:56:43 PM8/8/08
to turbogea...@googlegroups.com
Hola, Alberto.

On Friday 08 August 2008 19:51:26 Alberto Valverde wrote:
> I think it'll be better to propose it to the Pylons folks and send them
> a patch so it is changed upstream in PylonsApp. It frankly surprises me
> that this setting can't be changed since there's even a 'pylons.paths'
> config key which suggests it should. I'm almost sure it is a bug.

I already talked with them about it on IRC, but 'benbangert' simply pointed me
to the documentation of find_controller(), which says that it should be
overridden to change the default behavior.

I'd be glad to fix this, either on Pylons or TG, but I'm not sure that they
want this in Pylons.

signature.asc

Alberto Valverde

unread,
Aug 8, 2008, 2:41:48 PM8/8/08
to turbogea...@googlegroups.com, pylons-...@googlegroups.com
Gustavo Narea wrote:
> Hola, Alberto.
>
> On Friday 08 August 2008 19:51:26 Alberto Valverde wrote:
>
>> I think it'll be better to propose it to the Pylons folks and send them
>> a patch so it is changed upstream in PylonsApp. It frankly surprises me
>> that this setting can't be changed since there's even a 'pylons.paths'
>> config key which suggests it should. I'm almost sure it is a bug.
>>
>
> I already talked with them about it on IRC, but 'benbangert' simply pointed me
> to the documentation of find_controller(), which says that it should be
> overridden to change the default behavior.
>

I think Ben must have been busy when you talked with him and not given
too much thought to it... ;)

I'm almost sure this is a bug, it makes no sense to me that pylons.paths
is used in [1] to configure the Mapper while find_packages() hardcodes
it. If someone using pylons&routes needs to change the controller's
package like you're doing, which seems pretty reasonable to me, he/she
will need to both subclass PylonsApp and change 'pylons.paths' so the
Mapper can scan the controllers. Quite unDRY to my eyes. Besides that,
the fix in PylonsApp.find_controller seems trivial unless I'm missing
something obvious...

Perhaps a patch helps them to change their mind... :)


> I'd be glad to fix this, either on Pylons or TG, but I'm not sure that they
> want this in Pylons.
>

I'm cc'ing pylons-devel to see what they have to say.

BTW, I think it's better to bring up this issues in a ML or Trac
rather-than/besides-to IRC since they can be considered with more time,
they're easier to search for in the future and leave more of a record.

Alberto

[1]
http://pylonshq.com/project/pylonshq/browser/pylons/templates/default_project/%2Bpackage%2B/config/routing.py_tmpl#L12

Reply all
Reply to author
Forward
0 new messages