This repository was archived by the owner on Oct 27, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlodelsites_em.py
More file actions
85 lines (72 loc) · 2.33 KB
/
Copy pathlodelsites_em.py
File metadata and controls
85 lines (72 loc) · 2.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/usr/bin/python3
#
# This file is part of Lodel 2 (https://github.com/OpenEdition)
#
# Copyright (C) 2015-2017 Cléo UMS-3287
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
from lodel.context import LodelContext
LodelContext.init()
from lodel.settings.settings import Settings as settings
settings('globconf.d')
from lodel.settings import Settings
from lodel.editorial_model.components import *
from lodel.editorial_model.exceptions import *
from lodel.editorial_model.model import EditorialModel
em = EditorialModel('LodelSites', 'LodelSites editorial model')
base_group = em.new_group(
'base_group',
display_name = 'Base group',
help_text = 'Base group that implements base EM features (like classtype)'
)
em_lodel_site = em.new_class(
'LodelSite',
group = base_group
)
em_lodel_site.new_field(
'name',
display_name = 'lodelSiteName',
help_text = 'Lodel site full name',
group = base_group,
data_handler = 'varchar'
)
em_lodel_site.new_field(
'shortname',
display_text = 'lodelSiteShortName',
help_text = 'Lodel site short string identifier',
group = base_group,
data_handler = 'varchar',
max_length = 5,
uniq = True
)
em_lodel_site.new_field(
'extensions',
display_text = 'lodeSiteExtensions',
help_text = 'Lodel site extensions',
group = base_group,
data_handler = 'varcharlist',
delimiter = ' '
)
em_lodel_site.new_field(
'em_groups',
display_text = 'lodelSiteEmGroups',
help_text = 'Lodel site EM groups',
group = base_group,
data_handler = 'text',
)
pickle_file_path = 'examples/lodelsites_em.pickle'
xml_file_path = 'examples/lodelsites_em.xml'
em.save('xmlfile', filename=xml_file_path)
em.save('picklefile', filename=pickle_file_path)