blob: 5dc3547364ebab43c38cb4eba65668bc43665197 (
plain)
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 webob import Response
from repoze.bfg.template import TemplateView
def datestring(dt):
return dt.strftime('%Y-%m-%dT%H:%M:%S')
class BlogDefaultView(TemplateView):
def getInfo(self):
entrydata = []
for name, entry in self.context.items():
entrydata.append(
{
'name':name,
'title':entry.title,
'author':entry.author,
'created':datestring(entry.created),
}
)
return {'name':self.context.__name__, 'entries':entrydata}
class BlogEntryDefaultView(TemplateView):
def getInfo(self):
return {
'name':self.context.__name__,
'title':self.context.title,
'body':self.context.body,
'author':self.context.author,
'created':datestring(self.context.created),
}
|