urls = re.findall('(?:(?:ftp|https?):\/\/|\\bwww\.|\\bftp\.)[,\w\.\-\/@:%?&=%+#~_$\*]+[\w=\/&=+#]', str, re.I | re.S)
updated = False
for url in urls:
- updated = self._add_url(contact, url, unique or url) or updated
+ updated = self._add_url(contact, url, unique or re.sub('(?:.*://)?(\w+(?:[\w\.])*).*', '\\1', url)) or updated
return updated
while ai.has_next():
attr = ai.next(as_a = EVCardAttribute)
existing = string_at(attr.value().next())
+ #print "Existing URL [%s] when adding [%s] to [%s] with constraint [%s]" % (existing, url, contact.get_name(), unique)
if existing == unique or existing == url:
return False
elif existing.find(unique) > -1:
url_attr = attr
- break
if not url_attr:
ai.add()