fix profiles urls

This commit is contained in:
Romain Bignon 2011-12-03 21:50:36 +01:00
commit 3f48882844
3 changed files with 8 additions and 4 deletions

View file

@ -206,8 +206,8 @@ class AuMBackend(BaseBackend, ICapMessages, ICapMessagesPost, ICapDating, ICapCh
flags |= Message.IS_ACCUSED
signature = u''
#if mail['src']:
# signature += u'Sent from my %s\n\n' % mail['src']
if mail.get('src', None):
signature += u'Sent from my %s\n\n' % mail['src']
if mail['id_from'] in contacts:
signature += contacts[mail['id_from']].get_text()

View file

@ -77,13 +77,17 @@ class AuMBrowser(BaseBrowser):
my_coords = (0,0)
def id2url(self, id):
return 'http://www.adopteunmec.com/%s' % id
return 'http://www.adopteunmec.com/index.php/profile/%s' % id
def url2id(func):
def inner(self, id, *args, **kwargs):
m = re.match('^http://.*adopteunmec.com.*/(\d+)$', str(id))
if m:
id = int(m.group(1))
else:
m = re.match('^http://.*adopteunmec.com/index.php/profile/(\d+).*', str(id))
if m:
id = int(m.group(1))
return func(self, id, *args, **kwargs)
return inner

View file

@ -63,7 +63,7 @@ class FieldProfileURL(FieldBase):
def get_value(self, profile, consts):
id = int(profile[self.key])
if id > 0:
return 'http://www.adopteunmec.com/%d' % id
return 'http://www.adopteunmec.com/index.php/profile/%d' % id
else:
return ''