Tornado 2 compatibility issue #24

Closed
billychasen opened this Issue Jul 11, 2011 · 6 comments

Projects

None yet

5 participants

Hey, just a heads up that I had to change the route regex for tornadio to work with tornado 2.

They don't allow unnamed groups in the routes regex.

My change billychasen@bda7f20

It seems to work fine, but could definitely use a code review

How did this manifest itself?

chatRoute = tornadio.get_router(chatservice.ChatHandler)

#configure the Tornado application                                                                                                                              
application = tornado.web.Application(
    [chatRoute.route()],
    enabled_protocols = ['websocket', 'flashsocket', 'xhr-multipart', 'xhr-polling'],
    flash_policy_port = flashport,
    flash_policy_file = 'flashpolicy.xml',
    socket_io_port = socketport,
)

Without my fix results in:

Traceback (most recent call last):
  File "chatserver.py", line 37, in <module>
    socket_io_port = socketport,
  File "/usr/local/lib/python2.6/dist-packages/tornado-2.0git-py2.6.egg/tornado/web.py", line 1180, in __init__
    if handlers: self.add_handlers(".*$", handlers)
  File "/usr/local/lib/python2.6/dist-packages/tornado-2.0git-py2.6.egg/tornado/web.py", line 1242, in add_handlers
    spec = URLSpec(pattern, handler, kwargs)
  File "/usr/local/lib/python2.6/dist-packages/tornado-2.0git-py2.6.egg/tornado/web.py", line 1781, in __init__
    "groups in url regexes must either be all named or all positional"
AssertionError: groups in url regexes must either be all named or all positional
Owner
mrjoes commented Aug 1, 2011

This was merged. I still did not migrate to Tornado 2, but it seems that change did not break older Tornado versions, so I assume it is working as expected.

@mrjoes mrjoes closed this Aug 1, 2011
hjwp commented Sep 27, 2011

seeing this issue again in tornado 2.1, I think....

  File "/usr/local/lib/python2.6/dist-packages/tornado-2.1-py2.6.egg/tornado/web.py", line 1818, in __init__
    "positional: %r" % self.regex.pattern)
AssertionError: groups in url regexes must either be all named or all positional: '/(?P<resource>socket.io/*)(?P<extra>)/(?P<protocol>(websocket|xhr-multipart|htmlfile|jsonp-polling|flashsocket|xhr-polling))/?(?P<session_id>[0-9a-zA-Z]*)/?((?P<protocol_init>\\d*?)|(?P<xhr_path>\\w*?))/?(?P<jsonp_index>\\d*?)$'
Owner
mrjoes commented Oct 7, 2011

You're using git HEAD or 0.5?

Because I tried it locally with Tornado 2.1 and it works as expected.

Serge.

On Fri, Oct 7, 2011 at 7:21 PM, Joe Dallago <
reply@reply.github.com>wrote:

Confirmed, I am also having this problem.

Reply to this email directly or view it on GitHub:
#24 (comment)

jayd3e commented Oct 7, 2011

I deleted my comment, as I had the old repo pulled down by mistake. Fixed now and it works fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment