Hi,
I have a fairly basic question on code that can be pulled right from
the user docs. I can't get the first rule of the Submount to be
reached without getting a the 301 exception. Using the code below I
get the following exception - is this expected? Is there a way to
write the Rule to match '/blog'?
Thanks in advance for any guidance,
Chris Vickerson
# exception message
Traceback (most recent call last):
File "werkzeug_submount.py", line 17, in <module>
result = adapter.match()
File "/Library/Python/2.6/site-packages/Werkzeug-0.6.2-py2.6.egg/
werkzeug/routing.py", line 1261, in match
url_quote(path_info.lstrip('/'), self.map.charset)
werkzeug.routing.RequestRedirect: 301: Moved Permanently
# Source code #
import werkzeug
from werkzeug.routing import Submount, Map, Rule, NotFound
url_map = Map([
Rule('/', endpoint='index'),
Submount('/blog', [
Rule('/', endpoint='blog/index'),
Rule('/entry/<entry_slug>', endpoint='blog/show')
])
])
builder = werkzeug.EnvironBuilder('/blog', method='GET', data={})
environ = builder.get_environ()
adapter = url_map.bind_to_environ(environ)
result = adapter.match()
--
You received this message because you are subscribed to the Google Groups
"pocoo-libs" 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/pocoo-libs?hl=en.