No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

lodelsites_em.py 2.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. #!/usr/bin/python3
  2. #-*- coding: utf-8 -*-
  3. from lodel.context import LodelContext
  4. LodelContext.init()
  5. from lodel.settings.settings import Settings as settings
  6. settings('globconf.d')
  7. from lodel.settings import Settings
  8. from lodel.editorial_model.components import *
  9. from lodel.editorial_model.exceptions import *
  10. from lodel.editorial_model.model import EditorialModel
  11. em = EditorialModel('LodelSites', 'LodelSites editorial model')
  12. base_group = em.new_group(
  13. 'base_group',
  14. display_name = 'Base group',
  15. help_text = 'Base group that implements base EM features (like classtype)'
  16. )
  17. em_lodel_site = em.new_class(
  18. 'LodelSite',
  19. group = base_group
  20. )
  21. em_lodel_site.new_field(
  22. 'name',
  23. display_name = 'lodelSiteName',
  24. help_text = 'Lodel site full name',
  25. group = base_group,
  26. data_handler = 'varchar'
  27. )
  28. em_lodel_site.new_field(
  29. 'shortname',
  30. display_text = 'lodelSiteShortName',
  31. help_text = 'Lodel site short string identifier',
  32. group = base_group,
  33. data_handler = 'regex',
  34. max_length = 5,
  35. regex = '^[0-9a-z_-]+$',
  36. primary_key = True
  37. )
  38. em_lodel_site.new_field(
  39. 'extensions',
  40. display_text = 'lodeSiteExtensions',
  41. help_text = 'Lodel site extensions',
  42. group = base_group,
  43. data_handler = 'varcharlist',
  44. delimiter = ' '
  45. )
  46. em_lodel_site.new_field(
  47. 'em_groups',
  48. display_text = 'lodelSiteEmGroups',
  49. help_text = 'Lodel site EM groups',
  50. group = base_group,
  51. data_handler = 'text',
  52. )
  53. user_group = em.new_group(
  54. 'users',
  55. display_name = 'Lodel users',
  56. help_text = 'Group that handle users en perm'
  57. )
  58. user = em.new_class(
  59. 'User',
  60. group = user_group
  61. )
  62. user.new_field(
  63. 'login',
  64. display_name = 'User login',
  65. help_text = 'login',
  66. group = user_group,
  67. data_handler = 'varchar',
  68. primary_key = True
  69. )
  70. user.new_field(
  71. 'password',
  72. display_name = 'Password',
  73. help_text = 'User password',
  74. group = user_group,
  75. data_handler = 'password',
  76. )
  77. pickle_file_path = 'examples/lodelsites_em.pickle'
  78. xml_file_path = 'examples/lodelsites_em.xml'
  79. em.save('xmlfile', filename=xml_file_path)
  80. em.save('picklefile', filename=pickle_file_path)