I've never used Appcelerator, so I may not be able to help much, but I can 
tell you that when @Service runs the wrapped method there's no request 

@ActionProtector is used with other decorators in TG2 and there's no problem 
at all, so I'd say the problem is on the @Service decorator. To confirm this, 
try the following decorator:
from decorator import decorator
from pylons import request

def mydec():
    def wrapper(func, *args, **kwargs):
        print request.environ
        return func(*args, **kwargs)
    return wrapper

Then replace @ActionProtector with @mydec:
# ...
    def create(msg, session, msgtype):
# ...

Then you should get the same exception, which will mean that it's a problem in 

Please let us know what happens.


On Thursday February 19, 2009 10:12:07 Iain Campbell wrote:
> Hi,
> I'm using repoze.what with Pylons and Appcelerator.
> Predicates are working fine for protecting controller actions, but
> when I try to protect an Appcelerator service, I get:
> TypeError: No object (name: request) has been registered for this thread
> There's more information and the full traceback here:
> http://community.appcelerator.org/message/8909#8909
> So, I think I've now solved this in repoze.what.plugins.pylonshq.utils:
> from pylons import request as req, response
> request = req._current_obj()
> which seems to set the request up and check the auth correctly.
> Being a bit of a newbie to all of this, can anyone say if there's a
> disadvantage to doing things this way? I've tested on my standard
> controller actions too and everything appears to work fine...
> Thanks,
> Iain

Gustavo Narea <http://gustavonarea.net/>.

Get rid of unethical constraints! Get freedomware:
Repoze-dev mailing list

Reply via email to