Generate an HTML page for url.
(url)
| 2619 | return "Error - %s" % url, contents |
| 2620 | |
| 2621 | def get_html_page(url): |
| 2622 | """Generate an HTML page for url.""" |
| 2623 | complete_url = url |
| 2624 | if url.endswith('.html'): |
| 2625 | url = url[:-5] |
| 2626 | try: |
| 2627 | if url in ("", "index"): |
| 2628 | title, content = html_index() |
| 2629 | elif url == "topics": |
| 2630 | title, content = html_topics() |
| 2631 | elif url == "keywords": |
| 2632 | title, content = html_keywords() |
| 2633 | elif '=' in url: |
| 2634 | op, _, url = url.partition('=') |
| 2635 | if op == "search?key": |
| 2636 | title, content = html_search(url) |
| 2637 | elif op == "topic?key": |
| 2638 | # try topics first, then objects. |
| 2639 | try: |
| 2640 | title, content = html_topicpage(url) |
| 2641 | except ValueError: |
| 2642 | title, content = html_getobj(url) |
| 2643 | elif op == "get?key": |
| 2644 | # try objects first, then topics. |
| 2645 | if url in ("", "index"): |
| 2646 | title, content = html_index() |
| 2647 | else: |
| 2648 | try: |
| 2649 | title, content = html_getobj(url) |
| 2650 | except ValueError: |
| 2651 | title, content = html_topicpage(url) |
| 2652 | else: |
| 2653 | raise ValueError('bad pydoc url') |
| 2654 | else: |
| 2655 | title, content = html_getobj(url) |
| 2656 | except Exception as exc: |
| 2657 | # Catch any errors and display them in an error page. |
| 2658 | title, content = html_error(complete_url, exc) |
| 2659 | return html.page(title, content) |
| 2660 | |
| 2661 | if url.startswith('/'): |
| 2662 | url = url[1:] |
no test coverage detected
searching dependent graphs…