Mercurial > piecrust2
comparison piecrust/serving.py @ 176:d47d9493bb0a
routes: When matching URIs, return metadata directly instead of the match object.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Sat, 03 Jan 2015 21:54:25 -0800 |
parents | e9a3d405e18f |
children | 430ee5b80962 |
comparison
equal
deleted
inserted
replaced
175:7aa5f7880f71 | 176:d47d9493bb0a |
---|---|
416 | 416 |
417 def find_routes(routes, uri): | 417 def find_routes(routes, uri): |
418 uri = uri.lstrip('/') | 418 uri = uri.lstrip('/') |
419 res = [] | 419 res = [] |
420 for route in routes: | 420 for route in routes: |
421 m = route.matchUri(uri) | 421 metadata = route.matchUri(uri) |
422 if m: | 422 if metadata: |
423 metadata = m.groupdict() | |
424 res.append((route, metadata)) | 423 res.append((route, metadata)) |
425 return res | 424 return res |
426 | 425 |
427 | 426 |
428 class ErrorMessageLoader(FileSystemLoader): | 427 class ErrorMessageLoader(FileSystemLoader): |