Issue #1063 resolved

cherrypy.url() recurses infinitely when is set true and doens't equal 'server'

Anonymous created an issue

When relative_urls is set to a value that evaluates to True (and doesn't equal 'server') for the current request's Application cherrypy.url() will recurse infinitely (i.e. until Python kills it for recursing too deep). E.g. setting up an application like this will get that result:



application = cherrypy.tree.mount(Controller(), '/', cp_config)

make cherrypy.url return relative URLs by default

application.relative_urls = True }}}

This patch fixes that behaviour (it should still apply to trunk, although line-numbers may have changed): {{{


--- /usr/share/pyshared/cherrypy/ 2009-04-13 07:38:03.000000000 +0200 +++ /usr/share/pyshared/cherrypy/ 2011-04-28 02:27:29.586869415 +0200 @@ -536,7 +536,7 @@ elif relative: # "A relative reference that does not begin with a scheme name # or a slash character is termed a relative-path reference." - old = url().split('/')[:-1] + old = url(relative=False).split('/')[:-1] new = newurl.split('/') while old and new: a, b = old[0], new[0] }}}

Reported by Giel van Schijndel

Comments (2)

  1. Log in to comment