author | Tero Marttila <terom@fixme.fi> |
Sun, 08 Feb 2009 00:29:36 +0200 | |
branch | sites |
changeset 41 | 9585441a4bfb |
parent 29 | b06ff4c05d42 |
child 42 | 5a72c00c4ae4 |
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 |
|
28 | 23 |
def breadcrumb (trail, links=True) : |
24 |
""" |
|
25 |
Returns a nicely formatted breadcrumb tail, optinally with links |
|
26 |
""" |
|
27 |
||
28 |
return ' » '.join( |
|
29 |
( |
|
30 |
'<a href="$site_url/%s">%s</a>' % (page.url, page.title) if links else page.title |
|
31 |
) for page in trail |
|
32 |
) |
|
33 |