A minute ago I was once again explaining how I do the dispatching with req.path_info_peek() / req.path_info_pop() and it struck me that it can be simplified quite a bit by adding a `pattern` argument to path_info_pop:
Optional ``pattern`` argument is a regexp to match the return value
before returning. If there is no match, no changes are made to the
request and None is returned.
So instead of this:
id = req.path_info_peek()
if id.isdigit():
req.path_info_pop()
return ArticleApp(int(id))
We can now do this:
id = req.path_info_pop('\d+')
if id:
return ArticleApp(int(id))
http://bitbucket.org/ianb/webob/changeset/45dc8e052537/--
Best Regards,
Sergey Schetinin
http://s3bk.com/ -- S3 Backup
http://word-to-html.com/ -- Word to HTML Converter