Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@action.requires(user_in(session))
@action.uses(db)
def todo(id):
db(db.todo.id == id).delete()
return dict()
@action.uses(db)
def todo():
return dict(id=db.todo.insert(info=request.json.get("info")))
@action("api/", method="DELETE")
@action.uses(session)
@action.requires(user_in(session))
@action.uses(db)
def todo(id):
db(db.todo.id == id).delete()
return dict()
@action("index")
@action.uses("index.html")
def index():
return {}
@action("hello")
@action.uses(T)
def hello():
return str(T("Hello World"))
@action("index")
@action.uses("index.html", session, T)
def index():
return dict(
languages=dumps(T.local.language),
mode=MODE,
user_id=(session.get("user") or {}).get("id"),
)
@action.uses(db, 'helloworld.html')
def helloworld(): return dict(name=request.forms.get('name', 'visitor'))
@action("logout", method="POST")
@action.uses(session)
def logout():
session["user"] = None
return dict()
@action("create_form", method=["GET", "POST"])
@action("update_form/", method=["GET", "POST"])
@action.uses("form.html", db, session, T)
def example_form(id=None):
form = Form(db.person, id, deletable=False, formstyle=FormStyleBulma)
rows = db(db.person).select()
return dict(form=form, rows=rows)
def __init__(self, db, policy=None, auth=None, path="service/{uuid}/"):
self.db = db
self.policy = policy
self.restapi = RestAPI(self.db, policy)
self.path = path.format(uuid=str(uuid.uuid4()))
args = [db, auth] if auth else [db]
f = action.uses(*args)(self.api)
f = action(self.path, method=["GET", "POST"])(f)
f = action(self.path + "/", method=["PUT", "DELETE"])(f)