Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2016
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1.  
  2. MONGO_HOST = 'localhost'
  3. MONGO_PORT = 27017
  4. MONGO_USERNAME = 'user'
  5. MONGO_PASSWORD = 'user'
  6. MONGO_DBNAME = 'evetest'
  7.  
  8. RESOURCE_METHODS = ['GET', 'POST', 'DELETE']
  9.  
  10. ITEM_METHODS = ['GET', 'PATCH', 'PUT', 'DELETE']
  11.  
  12. schema = {
  13. # Schema definition, based on Cerberus grammar. Check the Cerberus project
  14. # (https://github.com/nicolaiarocci/cerberus) for details.
  15. 'firstname': {
  16. 'type': 'string',
  17. 'minlength': 1,
  18. 'maxlength': 10,
  19. },
  20. 'lastname': {
  21. 'type': 'string',
  22. 'minlength': 1,
  23. 'maxlength': 15,
  24. 'required': True,
  25. # talk about hard constraints! For the purpose of the demo
  26. # 'lastname' is an API entry-point, so we need it to be unique.
  27. 'unique': True,
  28. },
  29. # 'role' is a list, and can only contain values from 'allowed'.
  30. 'role': {
  31. 'type': 'list',
  32. 'allowed': ["author", "contributor", "copy"],
  33. },
  34. # An embedded 'strongly-typed' dictionary.
  35. 'location': {
  36. 'type': 'dict',
  37. 'schema': {
  38. 'address': {'type': 'string'},
  39. 'city': {'type': 'string'}
  40. },
  41. },
  42. 'born': {
  43. 'type': 'datetime',
  44. },
  45. }
  46.  
  47. people = {
  48. 'item_title': 'person',
  49.  
  50. 'additional_lookup': {
  51. 'url': 'regex("[\w]+")',
  52. 'field': 'lastname'
  53. },
  54. 'cache_control': 'max-age=10,must-revalidate',
  55. 'cache_expires': 10,
  56.  
  57. 'resource_methods': ['GET', 'POST'],
  58.  
  59. 'schema': schema
  60. }
  61.  
  62. DOMAIN = {
  63. 'people': people,
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement