0001-deprecations-add-detection-of-python-condition-in-wo.patch
tests/admin_pages/test_deprecations.py | ||
---|---|---|
106 | 106 | |
107 | 107 |
sendsms = st0.add_action('sendsms', id='_sendsms') |
108 | 108 |
sendsms.to = 'xxx' |
109 |
sendsms.condition = {'type': 'python', 'value': 'True'} |
|
109 | 110 |
sendsms.parent = st0 |
110 | 111 |
st0.items.append(sendsms) |
111 | 112 | |
... | ... | |
186 | 187 |
assert [x.text for x in resp.pyquery('.section--python-condition li a')] == [ |
187 | 188 |
'foobar / Field "page1"', |
188 | 189 |
'foobar / Field "page2"', |
190 |
'test / SMS', |
|
189 | 191 |
] |
190 | 192 |
assert [x.text for x in resp.pyquery('.section--python-prefill li a')] == [ |
191 | 193 |
'foobar / Field "python_prefill"', |
wcs/backoffice/deprecations.py | ||
---|---|---|
175 | 175 |
url = action.get_admin_url() |
176 | 176 |
for string in action.get_computed_strings(): |
177 | 177 |
self.check_string(string, location_label=location_label, url=url) |
178 |
if getattr(action, 'condition', None): |
|
179 |
if action.condition.get('type') == 'python': |
|
180 |
self.add_report_line( |
|
181 |
location_label=location_label, |
|
182 |
url=url, |
|
183 |
category='python-condition', |
|
184 |
) |
|
178 | 185 |
if action.key == 'export_to_model': |
179 | 186 |
try: |
180 | 187 |
kind = action.model_file_validation(action.model_file) |
181 |
- |