Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def raise_400(request):
raise muffin.HTTPBadRequest()
@app.register(muffin.HTTPBadRequest)
def handle_400(request):
return muffin.Response(text='Custom 400', status=400)
async def post(self, request):
"""Create/Edit items."""
form = await self.get_form(request)
if not form.validate():
raise muffin.HTTPBadRequest(
text=json.dumps(form.errors), content_type='application/json')
await self.save_form(form, request)
raise muffin.HTTPFound(self.url)