Projet

Général

Profil

0004-backoffice-agenda-datasources-are-not-exported-48282.patch

Lauréline Guérin, 16 février 2021 16:00

Télécharger (3,02 ko)

Voir les différences:

Subject: [PATCH 4/5] backoffice: agenda datasources are not exported (#48282)

 tests/admin_pages/test_settings.py |  4 ++++
 wcs/admin/settings.py              | 14 ++++++++++++--
 2 files changed, 16 insertions(+), 2 deletions(-)
tests/admin_pages/test_settings.py
136 136
    CardDefCategory(name='foobar').store()
137 137
    Role(name='qux').store()
138 138
    NamedDataSource(name='quux').store()
139
    ds = NamedDataSource(name='agenda')
140
    ds.external = 'agenda'
141
    ds.store()
139 142
    NamedWsCall(name='corge').store()
140 143

  
141 144
    wf = Workflow(name='bar')
......
178 181
    assert 'categories/1' in filelist
179 182
    assert 'carddef_categories/1' in filelist
180 183
    assert 'datasources/1' in filelist
184
    assert 'datasources/2' not in filelist  # agenda datasource, not exported
181 185
    assert 'wscalls/corge' in filelist
182 186
    assert 'apiaccess/1' in filelist
183 187
    for filename in filelist:
wcs/admin/settings.py
54 54
from wcs.qommon import ident
55 55

  
56 56
from wcs.blocks import BlockDef
57
from wcs.formdef import FormDef
58 57
from wcs.carddef import CardDef
58
from wcs.data_sources import NamedDataSource
59
from wcs.formdef import FormDef
59 60
from wcs.workflows import Workflow, WorkflowImportError
60 61
from wcs.roles import Role
61 62

  
......
1000 1001
                        'roles',
1001 1002
                        'categories',
1002 1003
                        'carddef_categories',
1003
                        'datasources',
1004 1004
                        'wscalls',
1005 1005
                        'mail-templates',
1006 1006
                        'apiaccess',
......
1013 1013
                        if f == '.indexes':
1014 1014
                            continue
1015 1015
                        z.write(os.path.join(path, f), os.path.join(d, f))
1016
                if 'datasources' in self.dirs:
1017
                    for ds in NamedDataSource.select():
1018
                        if ds.external == 'agenda':
1019
                            continue
1020
                        node = ds.export_to_xml(include_id=True)
1021
                        misc.indent_xml(node)
1022
                        z.writestr(
1023
                            os.path.join('datasources', str(ds.id)),
1024
                            ET.tostring(node),
1025
                        )
1016 1026
                if 'formdefs' in self.dirs:
1017 1027
                    for formdef in FormDef.select():
1018 1028
                        node = formdef.export_to_xml(include_id=True)
1019
-