try:
if await consumersCRUD.get(form_data.username):
raise ValueError('Consumer with same username already exist.')
await security.validate_username(form_data.username)
await security.validate_password(form_data.password, form_data.confirm_password)
except ValueError as details:
context = {
'request': request,
'fields': ConsumerCreation.__fields__.values(),
'error': details
}
return auth_templates.TemplateResponse('sign-up.html', context=context)
if __name__ == '__main__':
if DEBUG and not __debug__:
raise ValueError(
'The value of the __debug__ variable must match the DEBUG flag'
)
uvicorn.run(app, host="0.0.0.0", port=8000)
if DEBUG:
columns = [column.name for column in self.storing_table.columns]
passed_parameters = data.keys()
for parameter in passed_parameters:
assert parameter in columns, \
f'The table called {self.storing_table.name} does not contain the column called {parameter}.'
for column in columns:
assert column in passed_parameters, \
f'The list of arguments passed to the {self.storing_table.name} ' \
f'table contains no argument for the {column} column.