equal
deleted
inserted
replaced
1 """ |
|
2 Helper functions for use in templates |
|
3 """ |
|
4 |
|
5 import time |
|
6 |
|
7 import config |
|
8 |
|
9 def now () : |
|
10 """ |
|
11 Returns the current date/time |
|
12 """ |
|
13 |
|
14 return time.strftime(config.DATETIME_FMT) |
|
15 |
|
16 def copyright_year () : |
|
17 """ |
|
18 Returns the current year |
|
19 """ |
|
20 |
|
21 return time.strftime("%Y") |
|
22 |
|
23 def validation_notice (site_host) : |
|
24 """ |
|
25 Returns a short "Validated XHTML & CSS" link text for the given site hostname |
|
26 """ |
|
27 |
|
28 return 'Validated <a href="http://validator.w3.org/check?uri=http://%(host)s">XHTML 1.0 Strict</a> & <a href="http://jigsaw.w3.org/css-validator/validator?uri=http://%(host)s">CSS 2.1</a>' % dict( |
|
29 host = site_host |
|
30 ) |
|
31 |
|
32 def breadcrumb (trail, links=True) : |
|
33 """ |
|
34 Returns a nicely formatted breadcrumb tail, optinally with links |
|
35 """ |
|
36 |
|
37 return ' » '.join( |
|
38 ( |
|
39 '<a href="$site_url/%s">%s</a>' % (page.url, page.title) if links else page.title |
|
40 ) for page in trail |
|
41 ) |
|
42 |
|