Browse Source

Adding the lodelsites_em.py for EM generation

No knowing what datahandler ought to be used for em_groups, I simply set
'text' in place of it. To be changed accordingly
Quentin Bonaventure 8 years ago
parent
commit
ec6da44b47
1 changed files with 68 additions and 0 deletions
  1. 68
    0
      lodelsites_em.py

+ 68
- 0
lodelsites_em.py View File

@@ -0,0 +1,68 @@
1
+#!/usr/bin/python3
2
+#-*- coding: utf-8 -*-
3
+
4
+from lodel.context import LodelContext
5
+LodelContext.init()
6
+
7
+from lodel.settings.settings import Settings as settings
8
+settings('globconf.d')
9
+from lodel.settings import Settings
10
+
11
+from lodel.editorial_model.components import *
12
+from lodel.editorial_model.exceptions import *
13
+from lodel.editorial_model.model import EditorialModel
14
+
15
+em = EditorialModel('LodelSites', 'LodelSites editorial model')
16
+
17
+base_group = em.new_group(
18
+    'base_group',
19
+    display_name = 'Base group',
20
+    help_text = 'Base group that implements base EM features (like classtype)'
21
+)
22
+
23
+em_lodel_site = em.new_class(
24
+    'LodelSite',
25
+    group = base_group,
26
+    abstract=True
27
+)
28
+
29
+em_lodel_site.new_field(
30
+    'name',
31
+    display_name = 'lodelSiteName',
32
+    help_text = 'Lodel site full name',
33
+    group = base_group,
34
+    data_handler = 'varchar'
35
+)
36
+
37
+em_lodel_site.new_field(
38
+    'shortname',
39
+    display_text = 'lodelSiteShortName',
40
+    help_text = 'Lodel site short string identifier',
41
+    group = base_group,
42
+    data_handler = 'varchar',
43
+    max_length = 5,
44
+    uniq = True
45
+)
46
+
47
+em_lodel_site.new_field(
48
+    'extensions',
49
+    display_text = 'lodeSiteExtensions',
50
+    help_text = 'Lodel site extensions',
51
+    group = base_group,
52
+    data_handler = 'list',
53
+    back_reference = ('Plugin', 'plugin_name') 
54
+)
55
+
56
+em_lodel_site.new_field(
57
+    'em_groups',
58
+    display_text = 'lodelSiteEmGroups',
59
+    help_text = 'Lodel site EM groups',
60
+    group = base_group,
61
+    data_handler = 'text',
62
+)
63
+
64
+pickle_file_path = 'examples/lodelsites_em.pickle'
65
+xml_file_path = 'examples/lodelsites_em.xml'
66
+
67
+em.save('xmlfile', filename=xml_file_path)
68
+em.save('picklefile', filename=pickle_file_path)

Loading…
Cancel
Save