Function
unique_username
(value, context: SqlalchemyContext)
Source from the content-addressed store, hash-verified
| 10 | |
| 11 | @hug.type(extend=hug.types.text, chain=True, accept_context=True) |
| 12 | def unique_username(value, context: SqlalchemyContext): |
| 13 | if context.db.query( |
| 14 | context.db.query(TestUser).filter(TestUser.username == value).exists() |
| 15 | ).scalar(): |
| 16 | raise ValueError("User with a username {0} already exists.".format(value)) |
| 17 | return value |
| 18 | |
| 19 | |
| 20 | class CreateUserSchema(Schema): |
Callers
nothing calls this directly
Tested by
no test coverage detected