Exemplo n.º 1
0
    def delete(self, id):
        jail = JailTypes.first(id=id)
        msg = "The jail could not be deleted."
        if jail:
            if JailTypes.delete(jail):
                msg = "Jail Type deleted."

        cherrypy.session['flash'] = msg

        raise cherrypy.HTTPRedirect('/jail_types')
Exemplo n.º 2
0
    def edit(self, id, **post):
        jail_type = JailTypes.first(id=id)
        if not jail_type:
            cherrypy.session['flash'] = "404 Jail Type Not Found"
            raise cherrypy.HTTPRedirect('/jail_types')

        if post:
            fields = ['ip', 'netmask']
            data = self._get_data('jail_type', fields, post)
            if jail_type.update(data, fields):
                cherrypy.session['flash'] = "Jail Type successfully updated."
                raise cherrypy.HTTPRedirect('/jail_types')

        env=dict(jail_type = jail_type)
        return self.render("/jail_types/edit.html", crumbs=self.crumbs, **env)