author | Tero Marttila <terom@fixme.fi> |
Sun, 08 Feb 2009 02:29:23 +0200 | |
branch | sites |
changeset 42 | 5a72c00c4ae4 |
parent 29 | b06ff4c05d42 |
child 43 | fc11c4e86a82 |
permissions | -rw-r--r-- |
26
9d3beac1b196
remove foo.html page, and rice up the footer a bit
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
1 |
""" |
9d3beac1b196
remove foo.html page, and rice up the footer a bit
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
2 |
Helper functions for use in templates |
9d3beac1b196
remove foo.html page, and rice up the footer a bit
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
3 |
""" |
9d3beac1b196
remove foo.html page, and rice up the footer a bit
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
4 |
|
9d3beac1b196
remove foo.html page, and rice up the footer a bit
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
5 |
import time |
9d3beac1b196
remove foo.html page, and rice up the footer a bit
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
6 |
|
9d3beac1b196
remove foo.html page, and rice up the footer a bit
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
7 |
import config |
9d3beac1b196
remove foo.html page, and rice up the footer a bit
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
8 |
|
9d3beac1b196
remove foo.html page, and rice up the footer a bit
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
9 |
def now () : |
9d3beac1b196
remove foo.html page, and rice up the footer a bit
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
10 |
""" |
9d3beac1b196
remove foo.html page, and rice up the footer a bit
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
11 |
Returns the current date/time |
9d3beac1b196
remove foo.html page, and rice up the footer a bit
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
12 |
""" |
9d3beac1b196
remove foo.html page, and rice up the footer a bit
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
13 |
|
9d3beac1b196
remove foo.html page, and rice up the footer a bit
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
14 |
return time.strftime(config.DATETIME_FMT) |
9d3beac1b196
remove foo.html page, and rice up the footer a bit
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
15 |
|
29
b06ff4c05d42
start prototyping some site-based code
Tero Marttila <terom@fixme.fi>
parents:
28
diff
changeset
|
16 |
def copyright_year () : |
b06ff4c05d42
start prototyping some site-based code
Tero Marttila <terom@fixme.fi>
parents:
28
diff
changeset
|
17 |
""" |
b06ff4c05d42
start prototyping some site-based code
Tero Marttila <terom@fixme.fi>
parents:
28
diff
changeset
|
18 |
Returns the current year |
b06ff4c05d42
start prototyping some site-based code
Tero Marttila <terom@fixme.fi>
parents:
28
diff
changeset
|
19 |
""" |
b06ff4c05d42
start prototyping some site-based code
Tero Marttila <terom@fixme.fi>
parents:
28
diff
changeset
|
20 |
|
b06ff4c05d42
start prototyping some site-based code
Tero Marttila <terom@fixme.fi>
parents:
28
diff
changeset
|
21 |
return time.strftime("%Y") |
b06ff4c05d42
start prototyping some site-based code
Tero Marttila <terom@fixme.fi>
parents:
28
diff
changeset
|
22 |
|
42
5a72c00c4ae4
more fiddling around with the irclogs layout/css, add query args to URL
Tero Marttila <terom@fixme.fi>
parents:
29
diff
changeset
|
23 |
def validation_notice (site_host) : |
5a72c00c4ae4
more fiddling around with the irclogs layout/css, add query args to URL
Tero Marttila <terom@fixme.fi>
parents:
29
diff
changeset
|
24 |
""" |
5a72c00c4ae4
more fiddling around with the irclogs layout/css, add query args to URL
Tero Marttila <terom@fixme.fi>
parents:
29
diff
changeset
|
25 |
Returns a short "Validated XHTML & CSS" link text for the given site hostname |
5a72c00c4ae4
more fiddling around with the irclogs layout/css, add query args to URL
Tero Marttila <terom@fixme.fi>
parents:
29
diff
changeset
|
26 |
""" |
5a72c00c4ae4
more fiddling around with the irclogs layout/css, add query args to URL
Tero Marttila <terom@fixme.fi>
parents:
29
diff
changeset
|
27 |
|
5a72c00c4ae4
more fiddling around with the irclogs layout/css, add query args to URL
Tero Marttila <terom@fixme.fi>
parents:
29
diff
changeset
|
28 |
return 'Validated <a href="http://validator.w3.org/check?uri=%(host)s">XHTML 1.0 Strict</a> & <a href="http://jigsaw.w3.org/css-validator/validator?uri=%(host)s">CSS 2.1</a>' % dict( |
5a72c00c4ae4
more fiddling around with the irclogs layout/css, add query args to URL
Tero Marttila <terom@fixme.fi>
parents:
29
diff
changeset
|
29 |
host = site_host |
5a72c00c4ae4
more fiddling around with the irclogs layout/css, add query args to URL
Tero Marttila <terom@fixme.fi>
parents:
29
diff
changeset
|
30 |
) |
5a72c00c4ae4
more fiddling around with the irclogs layout/css, add query args to URL
Tero Marttila <terom@fixme.fi>
parents:
29
diff
changeset
|
31 |
|
28 | 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 |