-
Notifications
You must be signed in to change notification settings - Fork 0
/
default.py
32 lines (22 loc) · 922 Bytes
/
default.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from krdf import *
from jinja2 import Environment, PackageLoader
from hashlib import sha1
rdf = Namespace("http://www.w3.org/1999/02/22-rdf-syntax-ns#")
foaf = Namespace("http://xmlns.com/foaf/0.1/")
nodetag = Namespace("tag:rymdkoloni.se,2009-07-13:")
rhzm = Namespace("http://rymdkoloni.se/rhzm/0.1/")
environment = Environment(loader=PackageLoader('rhzm', 'templates'))
###################################################
class Renderable(Resource):
def render(self):
return environment.get_template(self.template).render(this=self)
from modules.foaf import Person
from modules.dashboard import Comment
###################################################
environment.node_user = Person(nodetag.Kristoffer)
def hash(value):
return sha1(value).hexdigest()
environment.globals['hash'] = hash
def comments(uri):
return Comment.get(reply_to=uri)
environment.globals['comments'] = comments