author | Tero Marttila <terom@fixme.fi> |
Sun, 08 Feb 2009 02:55:53 +0200 | |
branch | sites |
changeset 184 | a3d9aa76790d |
parent 183 | 8c8d082c4657 |
permissions | -rw-r--r-- |
167
f2504700e273
remove foo.html page, and rice up the footer a bit
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
1 |
""" |
f2504700e273
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 |
f2504700e273
remove foo.html page, and rice up the footer a bit
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
3 |
""" |
f2504700e273
remove foo.html page, and rice up the footer a bit
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
4 |
|
f2504700e273
remove foo.html page, and rice up the footer a bit
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
5 |
import time |
f2504700e273
remove foo.html page, and rice up the footer a bit
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
6 |
|
f2504700e273
remove foo.html page, and rice up the footer a bit
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
7 |
import config |
f2504700e273
remove foo.html page, and rice up the footer a bit
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
8 |
|
f2504700e273
remove foo.html page, and rice up the footer a bit
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
9 |
def now () : |
f2504700e273
remove foo.html page, and rice up the footer a bit
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
10 |
""" |
f2504700e273
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 |
f2504700e273
remove foo.html page, and rice up the footer a bit
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
12 |
""" |
f2504700e273
remove foo.html page, and rice up the footer a bit
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
13 |
|
f2504700e273
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) |
f2504700e273
remove foo.html page, and rice up the footer a bit
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
15 |
|
170
532c595efa1a
start prototyping some site-based code
Tero Marttila <terom@fixme.fi>
parents:
169
diff
changeset
|
16 |
def copyright_year () : |
532c595efa1a
start prototyping some site-based code
Tero Marttila <terom@fixme.fi>
parents:
169
diff
changeset
|
17 |
""" |
532c595efa1a
start prototyping some site-based code
Tero Marttila <terom@fixme.fi>
parents:
169
diff
changeset
|
18 |
Returns the current year |
532c595efa1a
start prototyping some site-based code
Tero Marttila <terom@fixme.fi>
parents:
169
diff
changeset
|
19 |
""" |
532c595efa1a
start prototyping some site-based code
Tero Marttila <terom@fixme.fi>
parents:
169
diff
changeset
|
20 |
|
532c595efa1a
start prototyping some site-based code
Tero Marttila <terom@fixme.fi>
parents:
169
diff
changeset
|
21 |
return time.strftime("%Y") |
532c595efa1a
start prototyping some site-based code
Tero Marttila <terom@fixme.fi>
parents:
169
diff
changeset
|
22 |
|
183
8c8d082c4657
more fiddling around with the irclogs layout/css, add query args to URL
Tero Marttila <terom@fixme.fi>
parents:
170
diff
changeset
|
23 |
def validation_notice (site_host) : |
8c8d082c4657
more fiddling around with the irclogs layout/css, add query args to URL
Tero Marttila <terom@fixme.fi>
parents:
170
diff
changeset
|
24 |
""" |
8c8d082c4657
more fiddling around with the irclogs layout/css, add query args to URL
Tero Marttila <terom@fixme.fi>
parents:
170
diff
changeset
|
25 |
Returns a short "Validated XHTML & CSS" link text for the given site hostname |
8c8d082c4657
more fiddling around with the irclogs layout/css, add query args to URL
Tero Marttila <terom@fixme.fi>
parents:
170
diff
changeset
|
26 |
""" |
8c8d082c4657
more fiddling around with the irclogs layout/css, add query args to URL
Tero Marttila <terom@fixme.fi>
parents:
170
diff
changeset
|
27 |
|
184
a3d9aa76790d
implement channel_view count, the query stuff, css, layout all need some cleanup :(
Tero Marttila <terom@fixme.fi>
parents:
183
diff
changeset
|
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( |
183
8c8d082c4657
more fiddling around with the irclogs layout/css, add query args to URL
Tero Marttila <terom@fixme.fi>
parents:
170
diff
changeset
|
29 |
host = site_host |
8c8d082c4657
more fiddling around with the irclogs layout/css, add query args to URL
Tero Marttila <terom@fixme.fi>
parents:
170
diff
changeset
|
30 |
) |
8c8d082c4657
more fiddling around with the irclogs layout/css, add query args to URL
Tero Marttila <terom@fixme.fi>
parents:
170
diff
changeset
|
31 |
|
169 | 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 |