説明なし
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

lodelsites_em.py 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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 = 'varchar',
  34. max_length = 5,
  35. uniq = True
  36. )
  37. em_lodel_site.new_field(
  38. 'extensions',
  39. display_text = 'lodeSiteExtensions',
  40. help_text = 'Lodel site extensions',
  41. group = base_group,
  42. data_handler = 'varcharlist',
  43. delimiter = ' '
  44. )
  45. em_lodel_site.new_field(
  46. 'em_groups',
  47. display_text = 'lodelSiteEmGroups',
  48. help_text = 'Lodel site EM groups',
  49. group = base_group,
  50. data_handler = 'text',
  51. )
  52. pickle_file_path = 'examples/lodelsites_em.pickle'
  53. xml_file_path = 'examples/lodelsites_em.xml'
  54. em.save('xmlfile', filename=xml_file_path)
  55. em.save('picklefile', filename=pickle_file_path)