backoffice: agenda datasources are not exported (#48282)
This commit is contained in:
parent
e99ffa8876
commit
35a57b2418
|
@ -136,6 +136,9 @@ def test_settings_export_import(pub):
|
|||
CardDefCategory(name='foobar').store()
|
||||
Role(name='qux').store()
|
||||
NamedDataSource(name='quux').store()
|
||||
ds = NamedDataSource(name='agenda')
|
||||
ds.external = 'agenda'
|
||||
ds.store()
|
||||
NamedWsCall(name='corge').store()
|
||||
|
||||
wf = Workflow(name='bar')
|
||||
|
@ -178,6 +181,7 @@ def test_settings_export_import(pub):
|
|||
assert 'categories/1' in filelist
|
||||
assert 'carddef_categories/1' in filelist
|
||||
assert 'datasources/1' in filelist
|
||||
assert 'datasources/2' not in filelist # agenda datasource, not exported
|
||||
assert 'wscalls/corge' in filelist
|
||||
assert 'apiaccess/1' in filelist
|
||||
for filename in filelist:
|
||||
|
|
|
@ -54,8 +54,9 @@ from wcs.qommon.admin.logger import LoggerDirectory
|
|||
from wcs.qommon import ident
|
||||
|
||||
from wcs.blocks import BlockDef
|
||||
from wcs.formdef import FormDef
|
||||
from wcs.carddef import CardDef
|
||||
from wcs.data_sources import NamedDataSource
|
||||
from wcs.formdef import FormDef
|
||||
from wcs.workflows import Workflow, WorkflowImportError
|
||||
from wcs.roles import Role
|
||||
|
||||
|
@ -1000,7 +1001,6 @@ class SettingsDirectory(QommonSettingsDirectory):
|
|||
'roles',
|
||||
'categories',
|
||||
'carddef_categories',
|
||||
'datasources',
|
||||
'wscalls',
|
||||
'mail-templates',
|
||||
'apiaccess',
|
||||
|
@ -1013,6 +1013,16 @@ class SettingsDirectory(QommonSettingsDirectory):
|
|||
if f == '.indexes':
|
||||
continue
|
||||
z.write(os.path.join(path, f), os.path.join(d, f))
|
||||
if 'datasources' in self.dirs:
|
||||
for ds in NamedDataSource.select():
|
||||
if ds.external == 'agenda':
|
||||
continue
|
||||
node = ds.export_to_xml(include_id=True)
|
||||
misc.indent_xml(node)
|
||||
z.writestr(
|
||||
os.path.join('datasources', str(ds.id)),
|
||||
ET.tostring(node),
|
||||
)
|
||||
if 'formdefs' in self.dirs:
|
||||
for formdef in FormDef.select():
|
||||
node = formdef.export_to_xml(include_id=True)
|
||||
|
|
Loading…
Reference in New Issue