regex is not working in top level app

Bug #574630 reported by Alex
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
web.py
New
Undecided
Unassigned

Bug Description

Bug report originally filed on git:

When using subapplications regexes, the top level url definitions behave differently then regexes in subapplications. This is an example based on code in http://webpy.org/cookbook/subapp.

<b>blog.py:</b>
<pre>
import web

urls = (
  "", "reblog",
  "/(blog|Blog)", "blog" #change from original
)

class reblog:
    def GET(self): raise web.seeother('/')

class blog:
    def GET(self, path):
        return "blog " + path

app_blog = web.application(urls, locals())
</pre>

<b>code.py</b>
<pre>
import web
import blog
urls = (
  "/(blog|Blog)", blog.app_blog, #change from original
   # "/blog", blog.app_blog,
  "/(.*)", "index"
)

class index:
    def GET(self, path):
        return "hello " + path

app = web.application(urls, locals())

if __name__ == "__main__":
    app.run()
</pre>

The regex /(blog|Blog) is the same in blog.py and code.py however request GET http://localhost:1111/blog/Blog does not return the expected result. If the regex is commented out in code.py and replaced with the line below it GET request returns an expected result.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.