Exemplo n.º 1
0
 def index(self, id=None):
     if id:
         record = meta.Session.query(model.Foo).filter_by(id=id).first()
     else:
         record = model.Foo()
     assert record is not None, repr(id)
     c.fs = Foo.bind(record, data=request.POST or None)
     if request.POST and c.fs.validate():
         c.fs.sync()
         if id:
             meta.Session.update(record)
         else:
             meta.Session.add(record)
         meta.Session.commit()
         redirect_to(id=record.id)
     return render('/form.mako')
Exemplo n.º 2
0
 def index(self, id=None):
     if id:
         record = meta.Session.query(model.Files).filter_by(id=id).first()
     else:
         record = model.Files()
     assert record is not None, repr(id)
     c.fs = Files.bind(record, data=request.POST or None)
     if request.POST and c.fs.validate():
         c.fs.sync()
         if id:
             meta.Session.merge(record)
         else:
             meta.Session.add(record)
         meta.Session.commit()
         redirect(url.current(id=record.id))
     return render('/form.mako')
Exemplo n.º 3
0
 def render(self, name, **kwargs):
     return render('/%s.mako' % name, extra_vars=kwargs)
Exemplo n.º 4
0
 def render(self, name, **kwargs):
     return render('/forms/%s.mako' % name, extra_vars=kwargs)
Exemplo n.º 5
0
 def index(self):
     # Return a rendered template
     return render('/secured.mako')