Mercurial > piecrust2
comparison piecrust/serving/server.py @ 483:64e1cd71b30b
serve: Try to serve taxonomy pages after all normal pages have failed.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Tue, 21 Jul 2015 22:42:47 -0700 |
parents | 30f2c2a595f5 |
children | 16e705c58cae |
comparison
equal
deleted
inserted
replaced
482:cce911be024d | 483:64e1cd71b30b |
---|---|
448 'json': 'application/json'} | 448 'json': 'application/json'} |
449 | 449 |
450 | 450 |
451 def find_routes(routes, uri): | 451 def find_routes(routes, uri): |
452 res = [] | 452 res = [] |
453 tax_res = [] | |
453 for route in routes: | 454 for route in routes: |
454 metadata = route.matchUri(uri) | 455 metadata = route.matchUri(uri) |
455 if metadata is not None: | 456 if metadata is not None: |
456 res.append((route, metadata)) | 457 if route.is_taxonomy_route: |
457 return res | 458 tax_res.append((route, metadata)) |
459 else: | |
460 res.append((route, metadata)) | |
461 return res + tax_res | |
458 | 462 |
459 | 463 |
460 class ErrorMessageLoader(FileSystemLoader): | 464 class ErrorMessageLoader(FileSystemLoader): |
461 def __init__(self): | 465 def __init__(self): |
462 base_dir = os.path.join(RESOURCES_DIR, 'messages') | 466 base_dir = os.path.join(RESOURCES_DIR, 'messages') |