Пример #1
0
    def edit(self, **kw):
        values = []
        if kw.get("id"):
            key = Key.by_id(kw["id"])
            values = dict(id=key.id, key_name=key.key_name, numeric=key.numeric)

        return dict(form=self.form, action="./save", options={}, value=values)
Пример #2
0
 def save(self, **kw):
     if kw['id']:
         key = Key.by_id(kw['id'])
         key.key_name = kw['key_name']
     else:
         key = Key(key_name=kw['key_name'])
         session.add(key)
     if 'numeric' in kw:
         key.numeric = kw['numeric']
     flash( _(u"OK") )
     redirect(".")
Пример #3
0
 def save(self, **kw):
     if kw["id"]:
         key = Key.by_id(kw["id"])
         key.key_name = kw["key_name"]
     else:
         key = Key(key_name=kw["key_name"])
         session.add(key)
     if "numeric" in kw:
         key.numeric = kw["numeric"]
     flash(_(u"OK"))
     redirect(".")
Пример #4
0
 def save(self, **kw):
     if kw['id']:
         key = Key.by_id(kw['id'])
         key.key_name = kw['key_name']
     else:
         if Key.query.filter_by(key_name=kw['key_name']).first():
             flash(u"Key Type exists: %s" % kw['key_name'])
             redirect(".")
         key = Key(key_name=kw['key_name'])
         session.add(key)
     key.numeric = kw['numeric']
     flash(_(u"OK"))
     redirect(".")
Пример #5
0
 def save(self, **kw):
     if kw["id"]:
         key = Key.by_id(kw["id"])
         key.key_name = kw["key_name"]
     else:
         if Key.query.filter_by(key_name=kw["key_name"]).first():
             flash(u"Key Type exists: %s" % kw["key_name"])
             redirect(".")
         key = Key(key_name=kw["key_name"])
         session.add(key)
     key.numeric = kw["numeric"]
     flash(_(u"OK"))
     redirect(".")
Пример #6
0
    def edit(self, **kw):
        values = []
        if kw.get('id'):
            key = Key.by_id(kw['id'])
            values = dict(id=key.id,
                          key_name=key.key_name,
                          numeric=key.numeric)

        return dict(
            form=self.form,
            action='./save',
            options={},
            value=values,
        )
Пример #7
0
 def edit(self,**kw):
     values = []
     if kw.get('id'):
         key = Key.by_id(kw['id'])
         values = dict(
             id         = key.id,
             key_name   = key.key_name,
             numeric    = key.numeric
         )
     
     return dict(
         form = self.form,
         action = './save',
         options = {},
         value = values,
     )
Пример #8
0
 def remove(self, **kw):
     remove = Key.by_id(kw['id'])
     session.delete(remove)
     flash( _(u"%s Deleted") % remove.key_name )
     raise redirect(".")