On Sep 21, 6:18 am, grassoalvaro <[email protected]> wrote:
> Hi,
>
> i have a little problem with paster setup-app. Here's some code:
>
> [code]
> from pylons import url
> from pylons.decorators.secure import https
>
> class AccountPlugin(Plugin):
>     @https(url('/logowanie/', host=app_config.get('ssl_fullhost')))
>     def login(self):
>         ....
> [/code]
>
> and output after paster setup-app development.ini:
>
> [output]
> class AccountPlugin(Plugin):
>   File "/home/pako/ENV/tracepoint/tracepoint/plugins/account/
> account.py", line 460, in AccountPlugin
>     @https(url('/logowanie/', host=app_config.get('ssl_fullhost')))
>   File "/home/pako/ENV/lib/python2.6/site-packages/Paste-1.7.4-
> py2.6.egg/paste/registry.py", line 155, in __call__
>     return self._current_obj()(*args, **kw)
>   File "/home/pako/ENV/lib/python2.6/site-packages/Paste-1.7.4-
> py2.6.egg/paste/registry.py", line 197, in _current_obj
>     'thread' % self.____name__)
> TypeError: No object (name: url) has been registered for this thread
> [/output]
>
> Any idea how to fix it permanently? (i can remove line with https
> decorator and then type paster setup-app but this is annoying).

The problem is that the `pylons.url` helper is only "registered" in a
request context, somewhere in the bowels of `PylonsApp` [1]. When
running `setup-app`, that registration never happens.

I'm curious as to why this plugin module is being loaded during setup-
app. It looks like a controller or controller mixin, and I think those
are generally not imported during setup-app (not entirely sure,
though, because I don't use setup-app). If this module doesn't need to
be loaded and you can find a way to make it not be loaded, that would
be one way to solve this.

Another option would be to manually register `pylons.url` in the
setup_app function. If the above suggestion doesn't work, I'll write
back with how to do this (don't have time now). In the meantime, can
you paste your websetup.py somewhere?

[1] Right here, to be precise: 
http://bitbucket.org/bbangert/pylons/src/tip/pylons/wsgiapp.py#cl-150

-- 
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.

Reply via email to