[admin/mail_invalide,ldap_crans.py] Corrections mail_invalide

Ignore-this: 1c455a452a14d6b3a83d7b525d61d2ec

darcs-hash:20100318125156-ddb99-783ccec26efd921f7a52040dd5f3247d8e6c2ba2.gz
This commit is contained in:
Michel Blockelet 2010-03-18 13:51:56 +01:00
parent b1239e1291
commit 0d633d4e7b
2 changed files with 6 additions and 2 deletions

View file

@ -55,7 +55,7 @@ def generate_ps(proprio):
template = template.replace('~prenom~', proprio.prenom().encode('utf-8')) template = template.replace('~prenom~', proprio.prenom().encode('utf-8'))
template = template.replace('~nom~', proprio.nom().encode('utf-8')) template = template.replace('~nom~', proprio.nom().encode('utf-8'))
template = template.replace('~chambre~', proprio.chbre().encode('utf-8')) template = template.replace('~chambre~', proprio.chbre().encode('utf-8'))
template = template.replace('~mail~', proprio.email().encode('utf-8')) template = template.replace('~mail~', proprio.email().encode('utf-8').replace('_', '\\_'))
template = template.replace('~fin~', template = template.replace('~fin~',
time.strftime(format_date, time.localtime(time.time()+14*86400))) time.strftime(format_date, time.localtime(time.time()+14*86400)))

View file

@ -2050,7 +2050,7 @@ class Adherent(BaseProprietaire):
if valeur == False: if valeur == False:
# On enlève les blacklistes # On enlève les blacklistes
bl_mail_list = [x for x in self.blacklist() if 'mail_invalide' in x] bl_mail_list = [x for x in self.blacklist() if 'mail_invalide' in x]
now = time.time() now = int(time.time())
for bl_mail in bl_mail_list: for bl_mail in bl_mail_list:
bl_data = bl_mail.split('$') bl_data = bl_mail.split('$')
if int(bl_data[0]) <= now and bl_data[1] == '-': if int(bl_data[0]) <= now and bl_data[1] == '-':
@ -2059,6 +2059,9 @@ class Adherent(BaseProprietaire):
elif int(bl_data[0]) >= now: elif int(bl_data[0]) >= now:
self.blacklist((self.blacklist().index(bl_mail), self.blacklist((self.blacklist().index(bl_mail),
[str(now-2), str(now-1), 'mail_invalide', bl_data[3]])) [str(now-2), str(now-1), 'mail_invalide', bl_data[3]]))
# Sale, mais évite d'avoir plusieurs blacklistes sur les mêmes dates
now -= 2
elif valeur == None: elif valeur == None:
# On retourne l'existence d'une blackliste active ou future # On retourne l'existence d'une blackliste active ou future
bl_mail_list = [x for x in self.blacklist() if 'mail_invalide' in x] bl_mail_list = [x for x in self.blacklist() if 'mail_invalide' in x]
@ -2068,6 +2071,7 @@ class Adherent(BaseProprietaire):
if (int(bl_data[0]) <= now and bl_data[1] == '-') or int(bl_data[0]) >= now: if (int(bl_data[0]) <= now and bl_data[1] == '-') or int(bl_data[0]) >= now:
return True return True
return False return False
else: else:
raise ValueError, u'mail_invalide ne peut prendre que None ou False en argument' raise ValueError, u'mail_invalide ne peut prendre que None ou False en argument'