1.1 --- a/imiptools/data.py Mon Sep 11 23:57:30 2017 +0200
1.2 +++ b/imiptools/data.py Tue Sep 12 18:33:53 2017 +0200
1.3 @@ -946,6 +946,12 @@
1.4 return address
1.5
1.6 def is_mailto_uri(value):
1.7 +
1.8 + """
1.9 + Return whether 'value' is a mailto: URI, with the protocol potentially being
1.10 + in upper case.
1.11 + """
1.12 +
1.13 return value.lower().startswith("mailto:")
1.14
1.15 def get_uri(value):
1.16 @@ -953,6 +959,9 @@
1.17 "Return a URI for the given 'value'."
1.18
1.19 if not value: return None
1.20 +
1.21 + # Normalise to "mailto:" or return other URI form.
1.22 +
1.23 return is_mailto_uri(value) and ("mailto:%s" % value[7:]) or \
1.24 ":" in value and value or \
1.25 "mailto:%s" % get_address(value)