Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- MONGO_HOST = 'localhost'
- MONGO_PORT = 27017
- MONGO_USERNAME = 'user'
- MONGO_PASSWORD = 'user'
- MONGO_DBNAME = 'evetest'
- RESOURCE_METHODS = ['GET', 'POST', 'DELETE']
- ITEM_METHODS = ['GET', 'PATCH', 'PUT', 'DELETE']
- schema = {
- # Schema definition, based on Cerberus grammar. Check the Cerberus project
- # (https://github.com/nicolaiarocci/cerberus) for details.
- 'firstname': {
- 'type': 'string',
- 'minlength': 1,
- 'maxlength': 10,
- },
- 'lastname': {
- 'type': 'string',
- 'minlength': 1,
- 'maxlength': 15,
- 'required': True,
- # talk about hard constraints! For the purpose of the demo
- # 'lastname' is an API entry-point, so we need it to be unique.
- 'unique': True,
- },
- # 'role' is a list, and can only contain values from 'allowed'.
- 'role': {
- 'type': 'list',
- 'allowed': ["author", "contributor", "copy"],
- },
- # An embedded 'strongly-typed' dictionary.
- 'location': {
- 'type': 'dict',
- 'schema': {
- 'address': {'type': 'string'},
- 'city': {'type': 'string'}
- },
- },
- 'born': {
- 'type': 'datetime',
- },
- }
- people = {
- 'item_title': 'person',
- 'additional_lookup': {
- 'url': 'regex("[\w]+")',
- 'field': 'lastname'
- },
- 'cache_control': 'max-age=10,must-revalidate',
- 'cache_expires': 10,
- 'resource_methods': ['GET', 'POST'],
- 'schema': schema
- }
- DOMAIN = {
- 'people': people,
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement