Hey Nicholas,

(thread sidetrack ahead:)

I've got a question about your first comment, that the latest TG2 is broken: what version of Python are you running? did you install to a new virtualenv? and do the tests fail, or is it just your application that breaks?

Diez was also having trouble with the latest tip, but he hasn't replied as to what environment he was using when the problems occurred.

I'm basically responsible for the latest changes in the repository, so I'd like to fix them, but everything works fine for me with a fresh virtualenv in python2.5.4.

Thanks!

-- Anthony

On 4-Mar-10, at 4:02 PM, nicholas wrote:
OMG I just found the same problem.
This was exceedingly difficult to diagnose.
Especially since I just pulled down TG2 like yesterday and it was
broken...

My diagnosis was something about environ['pylons.routes_dict']['url']
It use to remove the leading '/'.
Now it does not.

When TGController tries to property intercept __before__ and __after__
it uses the 'url' to find the right object controller in which to find
__before__.

ObjectDispatchController._get_routing_info() makes the assumption that
the url will not have a leading '/'

I am not sure whether this is routes that is changing a contract, or
the Controller which is making a foolish assumption.

Is there a bug I should add to?  Should I create a bug?

n


On Mar 2, 2:37 am, nickphold <[email protected]> wrote:
Hey, just had a horrible time debugging an issue, turns out the new
version of routes breaks something and causes all requests to 404 in
at least python 2.5 and 2.6 for tg2. We fixed this issue by going back
to 1.11. Not sure if this will help but here is a sample trace.

serving on 0.0.0.0:50008 view athttp://127.0.0.1:50008
09:58:10,044 DEBUG [paste.httpserver.ThreadPool] Added task (0 tasks
queued)
09:58:10,045 DEBUG [txn.140430996646160] new transaction
09:58:10,047 DEBUG [routes.middleware] Matched GET /notify/newSample
09:58:10,047 DEBUG [routes.middleware] Route path: '*url', defaults:
{'action': u'routes_placeholder', 'controller': u'root'}
09:58:10,047 DEBUG [routes.middleware] Match dict: {'url': u'/notify/
newSample', 'action': u'routes_placeholder', 'controller': u'root'}
09:58:10,047 DEBUG [pylons.wsgiapp] Setting up Pylons stacked object
globals
09:58:10,048 DEBUG [pylons.wsgiapp] Resolved URL to controller:
u'root'
09:58:10,051 DEBUG [tg.wsgiapp] Found controller, module:
'portalservice.controllers.root', class: 'RootController'
09:58:10,051 DEBUG [pylons.wsgiapp] Controller appears to be a class,
instantiating
09:58:10,051 DEBUG [pylons.wsgiapp] Calling controller class with WSGI
interface
09:58:10,052 DEBUG [pylons.controllers.core] Calling '__before__'
method with keyword args: **{'pylons': <pylons.util.PylonsContext
object at 0x320e810>, 'url': u'/notify/newSample', 'start_response':
<function repl_start_response at 0x320ccf8>, 'controller': u'root',
'environ': {'routes.route': <routes.route.Route object at 0x3209850>,
'beaker.cache': <beaker.cache.CacheManager object at 0x3209b10>,
'toscawidgets.javascript.require_once': False, 'pylons.routes_dict':
{'url': u'/notify/newSample', 'action': u'routes_placeholder',
'controller': u'root'}, 'beaker.get_session': <bound method
SessionMiddleware._get_session of <beaker.middleware.SessionMiddleware
object at 0x3209a90>>, 'SCRIPT_NAME': '', 'webob.adhoc_attrs':
{'language': 'en-us'}, 'REQUEST_METHOD': 'GET', 'PATH_INFO': '/ notify/
newSample', 'repoze.tm.active': True, 'SERVER_PROTOCOL': 'HTTP/1.0',
'QUERY_STRING': 'inj=fluorine&uj=756', 'paste.throw_errors': True,
'CONTENT_LENGTH': '0', 'HTTP_USER_AGENT': 'Python-urllib/1.17',
'SERVER_NAME': '0.0.0.0', 'REMOTE_ADDR': '127.0.0.1',
'pylons.environ_config': {'session': 'beaker.session', 'cache':
'beaker.cache'}, 'pylons.pylons': <pylons.util.PylonsContext object at
0x320e810>, 'wsgi.url_scheme': 'http', 'wsgiorg.routing_args':
(<routes.util.URLGenerator object at 0x320e690>, {'url': u'/notify/
newSample', 'action': u'routes_placeholder', 'controller': u'root'}),
'SERVER_PORT': '50008', 'toscawidgets.framework':
<tw.mods.base.HostFramework object at 0x3209b90>, 'pylons.controller':
<portalservice.controllers.root.RootController object at 0x320e8d0>,
'wsgi.input': <socket._fileobject object at 0x320c758 length=0>,
'HTTP_HOST': '127.0.0.1:50008', 'beaker.session': {'_id':
'7b4f377cacb90c278345b48c9320cfff'}, 'wsgi.multithread': True,
'routes.url': <routes.util.URLGenerator object at 0x320e690>,
'wsgi.version': (1, 0), 'paste.registry': <paste.registry.Registry
object at 0x320e210>, 'toscawidgets.prefix': '/toscawidgets',
'wsgi.run_once': False, 'wsgi.errors': <open file '<stderr>', mode 'w'
at 0x7fb8af831140>, 'wsgi.multiprocess': False, 'CONTENT_TYPE': '',
'paste.httpserver.thread_pool': <paste.httpserver.ThreadPool object at
0x136f110>}, 'action': u'routes_placeholder'}
09:58:10,052 INFO  [tg.i18n] Set request language to []
09:58:10,052 INFO  [tg.i18n] Language []: not supported by FormEncode
09:58:10,053 DEBUG [tg.controllers] No controller-wide authorization
at /notify/newSample
09:58:10,053 DEBUG [pylons.controllers.core] Merging pylons.response
headers into start_response call, status: 404 Not Found
09:58:10,054 DEBUG [txn.140430996646160] commit
09:58:10,054 DEBUG [txn.140430996646160] new transaction
09:58:10,054 DEBUG [routes.middleware] Matched GET /error/document
09:58:10,054 DEBUG [routes.middleware] Route path: '*url', defaults:
{'action': u'routes_placeholder', 'controller': u'root'}
09:58:10,054 DEBUG [routes.middleware] Match dict: {'url': u'/error/
document', 'action': u'routes_placeholder', 'controller': u'root'}
09:58:10,055 DEBUG [pylons.wsgiapp] Setting up Pylons stacked object
globals
09:58:10,055 DEBUG [pylons.wsgiapp] Resolved URL to controller:
u'root'
09:58:10,055 DEBUG [pylons.wsgiapp] Controller appears to be a class,
instantiating
09:58:10,055 DEBUG [pylons.wsgiapp] Calling controller class with WSGI
interface
09:58:10,055 DEBUG [pylons.controllers.core] Calling '__before__'
method with keyword args: **{'pylons': <pylons.util.PylonsContext
object at 0x321b310>, 'url': u'/error/document', 'start_response':
<function repl_start_response at 0x3216e60>, 'controller': u'root',
'environ': {'wsgi.multiprocess': False, 'pylons.original_response':
<Response at 0x320e310 404 Not Found>, 'beaker.cache':
<beaker.cache.CacheManager object at 0x3209b10>,
'toscawidgets.javascript.require_once': False, 'pylons.routes_dict':
{'url': u'/error/document', 'action': u'routes_placeholder',
'controller': u'root'}, 'SERVER_PROTOCOL': 'HTTP/1.0', 'SCRIPT_NAME':
'', 'pylons.original_request': <Request at 0x320e390 GEThttp:// 127.0.0.1:50008/notify/newSample?inj=fluorine&uj=756>,
'webob.adhoc_attrs': {'response_type': None, 'language': 'en-us',
'response_ext': None}, 'REQUEST_METHOD': 'GET', 'PATH_INFO': '/error/
document', 'repoze.tm.active': True, 'beaker.get_session': <bound
method SessionMiddleware._get_session of
<beaker.middleware.SessionMiddleware object at 0x3209a90>>,
'QUERY_STRING': 'inj=fluorine&uj=756', 'paste.throw_errors': True,
'CONTENT_LENGTH': '0', 'HTTP_USER_AGENT': 'Python-urllib/1.17',
'SERVER_NAME': '0.0.0.0', 'routes.route': <routes.route.Route object
at 0x3209850>, 'pylons.environ_config': {'session': 'beaker.session',
'cache': 'beaker.cache'}, 'pylons.pylons': <pylons.util.PylonsContext
object at 0x321b310>, 'wsgi.url_scheme': 'http',
'wsgiorg.routing_args': (<routes.util.URLGenerator object at
0x321b210>, {'url': u'/error/document', 'action':
u'routes_placeholder', 'controller': u'root'}), 'SERVER_PORT':
'50008', 'toscawidgets.framework': <tw.mods.base.HostFramework object
at 0x3209b90>, 'pylons.controller':
<portalservice.controllers.root.RootController object at 0x321b450>,
'wsgi.input': <socket._fileobject object at 0x320c758 length=0>,
'HTTP_HOST': '127.0.0.1:50008', 'beaker.session': {'_id':
'e182b6500d77717b340a7384fae37c33'}, 'wsgi.multithread': True,
'routes.url': <routes.util.URLGenerator object at 0x321b210>,
'wsgi.version': (1, 0), 'paste.registry': <paste.registry.Registry
object at 0x320e210>, 'toscawidgets.prefix': '/toscawidgets',
'wsgi.run_once': False, 'wsgi.errors': <open file '<stderr>', mode 'w'
at 0x7fb8af831140>, 'REMOTE_ADDR': '127.0.0.1', 'CONTENT_TYPE': '',
'paste.httpserver.thread_pool': <paste.httpserver.ThreadPool object at
0x136f110>}, 'action': u'routes_placeholder'}
09:58:10,056 INFO  [tg.i18n] Set request language to []
09:58:10,056 INFO  [tg.i18n] Language []: not supported by FormEncode
09:58:10,056 DEBUG [tg.controllers] No controller-wide authorization
at /error/document
09:58:10,057 DEBUG [pylons.controllers.core] Merging pylons.response
headers into start_response call, status: 404 Not Found
09:58:10,057 DEBUG [txn.140430996646160] commit
^C09:58:10,751 INFO  [paste.httpserver.ThreadPool] Shutting down
threadpool

--
You received this message because you are subscribed to the Google Groups "TurboGears" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to turbogears [email protected]. For more options, visit this group at http://groups.google.com/ group/turbogears?hl=en.


--
You received this message because you are subscribed to the Google Groups 
"TurboGears" 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/turbogears?hl=en.

Reply via email to