Projet

Général

Profil

0001-depreciations-detect-usage-of-python-expressions-in-.patch

Frédéric Péters, 06 décembre 2022 17:56

Télécharger (2,3 ko)

Voir les différences:

Subject: [PATCH] depreciations: detect usage of python expressions in global
 triggers (#72127)

 tests/admin_pages/test_deprecations.py |  7 +++++++
 wcs/backoffice/deprecations.py         | 10 ++++++++++
 2 files changed, 17 insertions(+)
tests/admin_pages/test_deprecations.py
166 166
        st0.items.append(action)
167 167

  
168 168
    st0.add_action('aggregationemail')
169

  
170
    global_action = workflow.add_global_action('global')
171
    trigger = global_action.append_trigger('timeout')
172
    trigger.anchor = 'python'
173
    trigger.anchor_expression = 'form_var_date'
174

  
169 175
    workflow.store()
170 176

  
171 177
    data_source = NamedDataSource(name='ds_python')
......
217 223
        'test / User Profile Update',
218 224
        'test / Email',
219 225
        'test / Email',
226
        'test / trigger in global',
220 227
        'Webservice "Hello"',
221 228
    ]
222 229
    assert [x.text for x in resp.pyquery('.section--script li a')] == [
wcs/backoffice/deprecations.py
204 204
                            )
205 205
                            break
206 206

  
207
            for global_action in workflow.global_actions or []:
208
                location_label = '%s / %s' % (workflow.name, _('trigger in %s') % global_action.name)
209
                for trigger in global_action.triggers or []:
210
                    url = '%striggers/%s/' % (global_action.get_admin_url(), trigger.id)
211
                    if trigger.key == 'timeout' and trigger.anchor == 'python':
212
                        self.add_report_line(
213
                            location_label=location_label, url=url, category='python-expression'
214
                        )
215
                        break
216

  
207 217
            self.increment_count()
208 218

  
209 219
        for named_data_source in named_data_sources:
210
-