Exemplo n.º 1
0
 def get(self, status):
     if not self.request.user:
         return redirect('/login/?to=%s' % self.request.url)
     store = store_manager.getStore()
     sources = store.find(Source, Source.status==status)
     paginator = Paginator(sources, 100)
     try:
         num = int(self.request.args.get('page', '1'))
     except ValueError:
         num = 1
     try:
         page = paginator.page(num)
     except InvalidPage:
         raise NotFound
     tmpl = env.get_template('index.html')
     s = tmpl.render(
             request = self.request,
             status = status,
             page = page,
     )
     return Response(s)
Exemplo n.º 2
0
def render_for_response(request, html, dic=None, **kwargs):
    template = env.get_template(html)
    if dic:
        kwargs.update(dic)
    request.content = template.render(**kwargs)
    return request
Exemplo n.º 3
0
def render_for_response(request, html, dic=None, **kwargs):
    template = env.get_template(html)
    if dic:
        kwargs.update(dic)
    request.content = template.render(**kwargs)
    return request