equal
deleted
inserted
replaced
|
1 # -*- coding: utf-8 -*- |
|
2 import os |
|
3 os.environ["DJANGO_SETTINGS_MODULE"] = 'data.settings' |
|
4 |
|
5 from django import template |
|
6 |
|
7 |
|
8 def encode_output(self, output): |
|
9 # Check type so that we don't run str() on a Unicode object |
|
10 if not isinstance(output, basestring): |
|
11 return unicode(output) |
|
12 return output |
|
13 |
|
14 template.VariableNode.encode_output = encode_output |
|
15 |
|
16 from cubicweb.common.view import StartupView |
|
17 |
|
18 INDEX_TEMPLATE = template.Template(u''' |
|
19 <h1>hellĂ´ {{ user.login }}</h1> |
|
20 ''') |
|
21 |
|
22 class MyIndex(StartupView): |
|
23 id = 'index' |
|
24 |
|
25 def call(self): |
|
26 ctx = template.Context({'user': self.req.user}) |
|
27 return INDEX_TEMPLATE.render(ctx) |