Subject match filtering - followup patch request

Daniel Axtens dja at
Thu Mar 8 22:38:22 AEDT 2018

Hi Veronika,

I tried to use the subject match filter and clearly got the RE wrong, as I
get the following messages when trying to parse mail.

Traceback (most recent call last):
  File "", line 11, in <module>
  File "/usr/local/lib/python3.6/dist-packages/django/core/management/", line 364, in execute_from_command_line
  File "/usr/local/lib/python3.6/dist-packages/django/core/management/", line 356, in execute
  File "/usr/local/lib/python3.6/dist-packages/django/core/management/", line 283, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/local/lib/python3.6/dist-packages/django/core/management/", line 330, in execute
    output = self.handle(*args, **options)
  File "/home/patchwork/patchwork/patchwork/management/commands/", line 100, in handle
    obj = parse_mail(msg, options['list_id'])
  File "/home/patchwork/patchwork/patchwork/", line 959, in parse_mail
    project = find_project(mail, list_id)
  File "/home/patchwork/patchwork/patchwork/", line 205, in find_project
    project = find_project_by_id_and_subject(listid, clean_subject)
  File "/home/patchwork/patchwork/patchwork/", line 173, in find_project_by_id_and_subject
  File "/usr/lib/python3.6/", line 182, in search
    return _compile(pattern, flags).search(string)
  File "/usr/lib/python3.6/", line 301, in _compile
    p = sre_compile.compile(pattern, flags)
  File "/usr/lib/python3.6/", line 562, in compile
    p = sre_parse.parse(p, flags)
  File "/usr/lib/python3.6/", line 855, in parse
    p = _parse_sub(source, pattern, flags & SRE_FLAG_VERBOSE, 0)
  File "/usr/lib/python3.6/", line 416, in _parse_sub
    not nested and not items))
  File "/usr/lib/python3.6/", line 523, in _parse
    source.tell() - here)
sre_constants.error: unterminated character set at position 2

Please could you add a hook somehwere (perhaps the .save() of the
Project model, but wherever is easy is fine) that checks if the RE
compiles before committing it to the database?

No rush.

Thanks in advance.


More information about the Patchwork mailing list