Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def run(self, project_name):
demo_project = Project.query.get(project_name)
db.session.delete(demo_project)
db.session.commit()
def put(self, project, bill_id):
form = get_billform_for(project, True, meta={"csrf": False})
if form.validate():
bill = Bill.query.get(project, bill_id)
form.save(bill, project)
db.session.commit()
return bill.id, 200
return form.errors, 400
def post(self):
form = ProjectForm(meta={"csrf": False})
if form.validate() and current_app.config.get("ALLOW_PUBLIC_PROJECT_CREATION"):
project = form.save()
db.session.add(project)
db.session.commit()
return project.id, 201
return form.errors, 400
If the demo project is deactivated, one is redirected to the create project form
"""
is_demo_project_activated = current_app.config["ACTIVATE_DEMO_PROJECT"]
project = Project.query.get("demo")
if not project and not is_demo_project_activated:
raise Redirect303(url_for(".create_project", project_id="demo"))
if not project and is_demo_project_activated:
project = Project(
id="demo",
name="demonstration",
password=generate_password_hash("demo"),
contact_email="demo@notmyidea.org",
)
db.session.add(project)
db.session.commit()
session[project.id] = True
return redirect(url_for(".list_bills", project_id=project.id))