[PATCH] Use email addresses of recipients as fallback to lookup the patch's project

Jeremy Kerr jk at ozlabs.org
Tue Apr 19 16:21:12 EST 2011

Hi Guilherme,

> This is used only when the List-ID lookup doesn't return any projects *and*
> the PATCHWORK_FALLBACK_TO_LISTEMAIL setting is set to True.

Just one more thing I noticed when applying this:

> +def extract_email_addresses(str):
> +    email_re = re.compile(
> +        r"([_\.0-9a-zA-Z-+=]+@(([0-9a-zA-Z-]{1,}\.)*)[a-zA-Z]{2,})")

Is there not an existing RE we can use here? Would be good not to have
to reinvent the wheel.

If not:

> +    # re.findall() will return a list of tuples because we have multiple
> +    # groups on the regex above, but we're only interested on the outermost
> +    # group (which should contain the whole email address), so we drop the
> +    # second and third groups.

In that case, use the non-grouping format: (?:...).

Also, using \w allows you to reduce the size of the regex.



More information about the Patchwork mailing list