Projet

Général

Profil

0001-deprecations-ignore-ezt-looking-tag-as-used-in-email.patch

Frédéric Péters, 19 décembre 2022 18:02

Télécharger (2,47 ko)

Voir les différences:

Subject: [PATCH] deprecations: ignore ezt looking "tag" as used in email
 subjects (#72039)

 tests/admin_pages/test_deprecations.py | 23 +++++++++++++++++++++++
 wcs/backoffice/deprecations.py         |  5 ++++-
 2 files changed, 27 insertions(+), 1 deletion(-)
tests/admin_pages/test_deprecations.py
270 270
    assert not job.report_lines
271 271

  
272 272

  
273
def test_deprecations_ignore_ezt_looking_tag(pub):
274
    workflow = Workflow(name='test')
275
    st0 = workflow.add_status('Status0', 'st0')
276
    sendmail = st0.add_action('sendmail')
277
    sendmail.subject = '[REMINDER] your appointment'
278
    workflow.store()
279
    job = DeprecationsScanAfterJob()
280
    job.execute()
281
    assert not job.report_lines
282

  
283
    sendmail.subject = '[reminder]'
284
    workflow.store()
285
    job = DeprecationsScanAfterJob()
286
    job.execute()
287
    assert job.report_lines
288

  
289
    sendmail.subject = '[if-any plop]test[end]'
290
    workflow.store()
291
    job = DeprecationsScanAfterJob()
292
    job.execute()
293
    assert job.report_lines
294

  
295

  
273 296
def test_deprecations_cronjob(pub):
274 297
    assert not os.path.exists(os.path.join(pub.app_dir, 'deprecations.json'))
275 298
    pub.update_deprecations_report()
wcs/backoffice/deprecations.py
271 271
                except ezt.EZTException:
272 272
                    pass
273 273
                else:
274
                    self.add_report_line(location_label=location_label, url=url, category='ezt')
274
                    if not re.match(r'\[[^]]*[A-Z][^]]*\]', string):
275
                        # don't warn on leading [] expression if it has uppercases,
276
                        # this typically happens as initial "tag" in an email subjet.
277
                        self.add_report_line(location_label=location_label, url=url, category='ezt')
275 278
            if re.findall(r'\Wscript\.\w', string):
276 279
                self.add_report_line(location_label=location_label, url=url, category='script')
277 280

  
278
-