This is my full traceback:

Starting subprocess with file monitor
2014-02-1392672254 22:24:14,250 WARNI [tgext.pluggable] TurboGears version 
< 2.3.1, disabling support for SQLAlchemy 0.9
2014-02-1392672254 22:24:14,254 INFO  [tgext.pluggable] Plugging 
switchboard_tg2
Traceback (most recent call last):
  File "/home/ricardo/env/tg222/bin/paster", line 9, in <module>
    load_entry_point('PasteScript==1.7.5', 'console_scripts', 'paster')()
  File 
"/home/ricardo/env/tg222/local/lib/python2.7/site-packages/PasteScript-1.7.5-py2.7.egg/paste/script/command.py",
 
line 104, in run
    invoke(command, command_name, options, args[1:])
  File 
"/home/ricardo/env/tg222/local/lib/python2.7/site-packages/PasteScript-1.7.5-py2.7.egg/paste/script/command.py",
 
line 143, in invoke
    exit_code = runner.run(args)
  File 
"/home/ricardo/env/tg222/local/lib/python2.7/site-packages/PasteScript-1.7.5-py2.7.egg/paste/script/command.py",
 
line 238, in run
    result = self.command()
  File 
"/home/ricardo/env/tg222/local/lib/python2.7/site-packages/PasteScript-1.7.5-py2.7.egg/paste/script/serve.py",
 
line 284, in command
    relative_to=base, global_conf=vars)
  File 
"/home/ricardo/env/tg222/local/lib/python2.7/site-packages/PasteScript-1.7.5-py2.7.egg/paste/script/serve.py",
 
line 321, in loadapp
    **kw)
  File 
"/home/ricardo/env/tg222/local/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/loadwsgi.py",
 
line 247, in loadapp
    return loadobj(APP, uri, name=name, **kw)
  File 
"/home/ricardo/env/tg222/local/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/loadwsgi.py",
 
line 272, in loadobj
    return context.create()
  File 
"/home/ricardo/env/tg222/local/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/loadwsgi.py",
 
line 710, in create
    return self.object_type.invoke(self)
  File 
"/home/ricardo/env/tg222/local/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/loadwsgi.py",
 
line 146, in invoke
    return fix_call(context.object, context.global_conf, 
**context.local_conf)
  File 
"/home/ricardo/env/tg222/local/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/util.py",
 
line 59, in fix_call
    reraise(*exc_info)
  File 
"/home/ricardo/env/tg222/local/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/compat.py",
 
line 22, in reraise
    exec('raise t, e, tb', dict(t=t, e=e, tb=tb))
  File 
"/home/ricardo/env/tg222/local/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/util.py",
 
line 56, in fix_call
    val = callable(*args, **kw)
  File "/home/ricardo/Workspace/atenea/sapns/config/middleware.py", line 
36, in make_app
    app = make_base_app(global_conf, full_stack=True, **app_conf)
  File 
"/home/ricardo/env/tg222/local/lib/python2.7/site-packages/TurboGears2-2.2.2-py2.7.egg/tg/configuration/app_config.py",
 
line 1059, in make_base_app
    app = hook(app)
  File 
"/home/ricardo/env/tg222/local/lib/python2.7/site-packages/tgext/pluggable/adapt_controllers.py",
 
line 10, in mount_controllers
    root_controller = TGApp().find_controller('root')
  File 
"/home/ricardo/env/tg222/local/lib/python2.7/site-packages/TurboGears2-2.2.2-py2.7.egg/tg/wsgiapp.py",
 
line 41, in find_controller
    __import__(full_module_name)
  File "/home/ricardo/Workspace/atenea/sapns/controllers/root.py", line 27, 
in <module>
    class RootController(BaseController):
  File "/home/ricardo/Workspace/atenea/sapns/controllers/root.py", line 
150, in RootController
    def post_logout(self, came_from=url('/')):
  File 
"/home/ricardo/env/tg222/local/lib/python2.7/site-packages/TurboGears2-2.2.2-py2.7.egg/tg/controllers/util.py",
 
line 80, in url
    base_url = pylons.request.environ['SCRIPT_NAME'] + base_url
  File 
"/home/ricardo/env/tg222/local/lib/python2.7/site-packages/Paste-1.7.5.1-py2.7.egg/paste/registry.py",
 
line 137, in __getattr__
    return getattr(self._current_obj(), attr)
  File 
"/home/ricardo/env/tg222/local/lib/python2.7/site-packages/Paste-1.7.5.1-py2.7.egg/paste/registry.py",
 
line 197, in _current_obj
    'thread' % self.____name__)
TypeError: No object (name: request) has been registered for this thread

Could it probably be related with the line *base_url = 
pylons.request.environ['SCRIPT_NAME'] + base_url*?

El lunes, 17 de febrero de 2014 22:19:18 UTC+1, Alessandro Molina escribió:
>
> You just posted the last row of the traceback, if you look at the previous 
> ones you should be able to see the one that is trying to access tg.request. 
> If that is outside of a controller, then that is the source of the crash.
>
>
> On Mon, Feb 17, 2014 at 10:09 PM, Ricardo Molina 
> <[email protected]<javascript:>
> > wrote:
>
>> I have removed all the  the switches (operator.is_active('foo')) from my 
>> code and I'm still getting this error. Therefore I think I am not plugging 
>> it in correctly, probably because I am using a CustomConfig class that 
>> inherits from AppConfig.
>>
>> Regards.
>>
>> El lunes, 17 de febrero de 2014 09:23:39 UTC+1, Alessandro Molina 
>> escribió:
>>>
>>> It looks to me that you are correctly enabling switchboard. It looks 
>>> like it's trying to access the request before outside of an HTTP request.
>>> I never used switchboard myself, so I don't know how it works, but I 
>>> suppose you might be trying to access to a switch value (is_active) outside 
>>> of a request.
>>>
>>>
>>> On Mon, Feb 17, 2014 at 12:05 AM, Ricardo Molina <ricardo.mo...@gmail.
>>> com> wrote:
>>>
>>>> I am trying to use switchboard-tg2 0.3 [ https://pypi.python.org/
>>>> pypi/switchboard-tg2/0.3 ] in my TurboGears 222 app, but I am getting 
>>>> this error:
>>>>
>>>> Starting subprocess with file monitor
>>>> 2014-02-1392590872 23:47:52,729 WARNI [tgext.pluggable] TurboGears 
>>>> version < 2.3.1, disabling support for SQLAlchemy 0.9
>>>> 2014-02-1392590872 23:47:52,731 INFO  [tgext.pluggable] Plugging 
>>>> switchboard_tg2
>>>> Traceback (most recent call last):
>>>>   ...
>>>>   ...
>>>>   ...
>>>> *  File 
>>>> "/home/ricardo/env/tg222/local/lib/python2.7/site-packages/Paste-1.7.5.1-py2.7.egg/paste/registry.py",
>>>>  
>>>> line 197, in _current_obj*
>>>> *    'thread' % self.____name__)*
>>>> *TypeError: No object (name: request) has been registered for this 
>>>> thread*
>>>>
>>>>
>>>> This is my *app_cfg.py* file, where I have plugged in switchboard_tg2:
>>>>
>>>> # -*- coding: utf-8 -*-
>>>>
>>>> #some imports
>>>> from tg.configuration import AppConfig
>>>> from tg.configuration.auth import TGAuthMetadata
>>>> import neptuno.util as np_util
>>>> *from tgext.pluggable import plug*
>>>>
>>>> #This tells to TurboGears how to retrieve the data for your user
>>>> class ApplicationAuthMetadata(TGAuthMetadata):
>>>>     def __init__(self, sa_auth):
>>>>         self.sa_auth = sa_auth
>>>>         
>>>>     def get_user(self, identity, userid):
>>>>         return self.sa_auth.dbsession.query(self.sa_auth.user_class).
>>>> filter_by(user_name=userid).first()
>>>>     
>>>>     def get_groups(self, identity, userid):
>>>>         return [g.group_name for g in identity['user'].groups]
>>>>     
>>>>     def get_permissions(self, identity, userid):
>>>>         return [p.permission_name for p in identity['user'].permissions]
>>>>
>>>> class CustomConfig(AppConfig):
>>>>     
>>>>     def __init__(self):
>>>>         super(CustomConfig, self).__init__()
>>>>         self.use_toscawidgets = False
>>>>         
>>>>         self.renderers = []
>>>>         
>>>>         self.package = sapns
>>>>         
>>>>         #Enable json in expose
>>>>         self.renderers.append('json')
>>>>         #Set the default renderer
>>>>         self.default_renderer = 'jinja'
>>>>         self.renderers.append('jinja')
>>>>         *self.renderers.append('mako')*
>>>>         self.jinja_extensions = ['jinja2.ext.i18n']
>>>>         self.use_dotted_templatenames = False # makes TG 2.1.5 work
>>>>         
>>>>         #Configure the base SQLALchemy Setup
>>>>         self.use_sqlalchemy = True
>>>>         self.model = sapns.model #@UndefinedVariable
>>>>         self.DBSession = sapns.model.DBSession #@UndefinedVariable
>>>>         
>>>>         # Configure the authentication backend
>>>>         self.auth_backend = 'sqlalchemy'
>>>>         self.sa_auth.dbsession = model.DBSession
>>>>         self.sa_auth.user_class = model.User
>>>>         #self.sa_auth.group_class = model.Group
>>>>         #self.sa_auth.permission_class = model.Permission
>>>>         self.sa_auth.authmetadata = ApplicationAuthMetadata(self.
>>>> sa_auth)
>>>>         
>>>>         # override this if you would like to provide a different who 
>>>> plugin for
>>>>         # managing login and logout of your application
>>>>         self.sa_auth.form_plugin = None
>>>>         
>>>>         # override this if you are using a different charset for the 
>>>> login form
>>>>         self.sa_auth.charset = 'utf-8'
>>>>         
>>>>         # You may optionally define a page where you want users to be 
>>>> redirected to
>>>>         # on login:
>>>>         self.sa_auth.post_login_url = '/post_login'
>>>>         
>>>>         # You may optionally define a page where you want users to be 
>>>> redirected to
>>>>         # on logout:
>>>>         self.sa_auth.post_logout_url = '/post_logout'        
>>>>     
>>>>     def setup_routes(self):
>>>>         
>>>>         from tg.configuration import config
>>>>         from routes.mapper import Mapper
>>>>
>>>>         map_ = Mapper(directory=config['pylons.paths']['controllers'],
>>>>                      always_scan=config['debug'])
>>>>
>>>>         # Setup a default route for the root of object dispatch
>>>>         controller_ = 'root'
>>>>         root_folder = config.get('app.root_folder')
>>>>         if root_folder:
>>>>             controller_ = '%s/root' % root_folder
>>>>
>>>>         map_.connect('*url', controller=controller_, 
>>>> action='routes_placeholder')
>>>>
>>>>         config['routes.map'] = map_
>>>>     
>>>> base_config = CustomConfig()
>>>> *plug(base_config, 'switchboard_tg2')*
>>>>
>>>>
>>>>
>>>> Does anyone know how to solve this issue (TypeError: No object (name: 
>>>> request) has been registered for this thread)?
>>>>
>>>> Thank you
>>>>
>>>>  -- 
>>>> You received this message because you are subscribed to the Google 
>>>> Groups "TurboGears" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>> an email to [email protected].
>>>> To post to this group, send email to [email protected].
>>>>
>>>> Visit this group at http://groups.google.com/group/turbogears.
>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>
>>>
>>>  -- 
>> You received this message because you are subscribed to the Google Groups 
>> "TurboGears" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> To post to this group, send email to [email protected]<javascript:>
>> .
>> Visit this group at http://groups.google.com/group/turbogears.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/turbogears.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to