mirror of
https://github.com/yweber/lodel2.git
synced 2026-11-15 15:41:39 +01:00
Test editorial model updated to use two different datasources
- defining a new datasource named dummy2 in both tests conf and install/conf.d - adding two class using the new datasource in em_test.py - index : abtract class representing indexes (two fields, name & content) - indextheme : thematic index, inheriting from index but with one more field "theme"
This commit is contained in:
parent
010decc4d3
commit
d6fbc5cfd1
5 changed files with 58 additions and 1 deletions
52
em_test.py
52
em_test.py
|
|
@ -288,5 +288,55 @@ text.new_field( 'linked_persons',
|
|||
group = editorial_person_group,
|
||||
)
|
||||
|
||||
#####################
|
||||
# Index classes # <--- Note : using a different datasource for testing
|
||||
##################### purpose
|
||||
|
||||
index_group = em.new_group( 'index_group',
|
||||
display_name = 'Indexes',
|
||||
help_text = {
|
||||
'eng': 'EM class that represents indexes'},
|
||||
depends = (editorial_group,))
|
||||
|
||||
index_abstract = em.new_class(
|
||||
'indexAbs',
|
||||
display_name = {'eng': 'Abstract Index'},
|
||||
help_text = {'eng': 'Abstract class common to each Index classes'},
|
||||
abstract = True,
|
||||
group = index_group,
|
||||
datasource = 'dummy2',
|
||||
parents = em_object)
|
||||
|
||||
index_name = index_abstract.new_field(
|
||||
'name',
|
||||
display_name = {
|
||||
'eng': 'name',
|
||||
'fre': 'nom'},
|
||||
data_handler = 'varchar')
|
||||
|
||||
index_value = index_abstract.new_field(
|
||||
'value',
|
||||
display_name = {
|
||||
'eng': 'value',
|
||||
'fre': 'valeur'},
|
||||
data_handler = 'varchar')
|
||||
|
||||
index_theme = em.new_class(
|
||||
'indexTheme',
|
||||
display_name = {
|
||||
'eng': 'Thematic index',
|
||||
'fre': 'Index thématique'},
|
||||
group = index_group,
|
||||
datasource = 'dummy2',
|
||||
parents = index_abstract)
|
||||
|
||||
index_theme_theme = index_abstract.new_field(
|
||||
'theme',
|
||||
display_name = {
|
||||
'eng': 'theme'},
|
||||
data_handler = 'varchar')
|
||||
|
||||
#em.save('xmlfile', filename = 'examples/em_test.xml')
|
||||
em.save('picklefile', filename = 'examples/em_test.pickle')
|
||||
pickle_file = 'examples/em_test.pickle'
|
||||
em.save('picklefile', filename = pickle_file)
|
||||
print("Output written in %s" % pickle_file)
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1,5 +1,10 @@
|
|||
[lodel2.datasources.default]
|
||||
identifier = dummy_datasource.example
|
||||
|
||||
[lodel2.datasources.dummy2]
|
||||
identifier = dummy_datasource.dummy2
|
||||
|
||||
[lodel2.datasource.dummy_datasource.example]
|
||||
dummy =
|
||||
[lodel2.datasource.dummy_datasource.dummy2]
|
||||
dummy =
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1,5 +1,7 @@
|
|||
[lodel2.datasources.default]
|
||||
identifier = dummy_datasource.example
|
||||
[lodel2.datasources.dummy2]
|
||||
identifier = dummy_datasource.example
|
||||
|
||||
[lodel2.datasource.dummy_datasource.example]
|
||||
dummy =
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue