def edit_tokens(): if request.method == 'POST': try: # check if this is remove vs update POST request action = request.form.getlist('action') if action[0] == 'remove': # read in the content of a present click list_value = request.form.getlist('id') # if list is not empty - content has gone through if len(list_value) > 0: value = int(list_value[0]) # token exists since we delete from the dropdown from the db token = Tokens.get(Tokens.tokenid == value) # delete recursively - all dependencies incl. nullable token.delete_instance(recursive=True, delete_nullable=True) except socket.error: pass entries = [ dict(tid=each.tokenid, ttype=(Tokentypes.get( Tokentypes.tokentypeid == each.tokentypeid.tokentypeid) ).tokentype, ttypeid=each.tokentypeid.tokentypeid, ttoken=each.token, tdescr=each.description, tres=each.result, targs=each.args) for each in Tokens.select() ] return render_template('edit_tokens.html', entries=entries)
def list_devicerules(): # select device devices = [ dict(did=device.deviceid, dname=device.devicename) for device in Devices.select() ] # select token tokens = [ dict(tid=each.tokenid, tname=each.token) for each in Tokens.select() ] return render_template('list_devicerules.html', entries=[devices, tokens])
def list_devicerules(): # select device devices = [dict(did=device.deviceid, dname=device.devicename) for device in Devices.select()] # select token tokens = [dict(tid=each.tokenid, tname=each.token) for each in Tokens.select()] return render_template('list_devicerules.html', entries=[devices, tokens])
def edit_tokens(): if request.method == 'POST': try: # check if this is remove vs update POST request action = request.form.getlist('action') if action[0] == 'remove': # read in the content of a present click list_value = request.form.getlist('id') # if list is not empty - content has gone through if len(list_value) > 0: value = int(list_value[0]) # token exists since we delete from the dropdown from the db token = Tokens.get(Tokens.tokenid == value) # delete recursively - all dependencies incl. nullable token.delete_instance(recursive=True,delete_nullable=True) except socket.error: pass entries = [dict(tid=each.tokenid, ttype=(Tokentypes.get(Tokentypes.tokentypeid==each.tokentypeid.tokentypeid)).tokentype, ttypeid=each.tokentypeid.tokentypeid, ttoken=each.token, tdescr=each.description, tres=each.result, targs=each.args) for each in Tokens.select()] return render_template('edit_tokens.html', entries=entries)
def the_tokens(): return flask.render_template('mt.html', tokens=Tokens.select())