X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=bin%2Flists.rpc.py;h=cda3511ba7fe0267dcf4ef51ac899ca38ef4ffef;hb=3424387cde6c635ff16c3b5459c4caa88bb76e2e;hp=ff30e732d3dca38cb7c9dccadc87dedbd78fe033;hpb=d82359a556779137f8a90d0312b3098a2db6f482;p=platal.git diff --git a/bin/lists.rpc.py b/bin/lists.rpc.py index ff30e73..cda3511 100755 --- a/bin/lists.rpc.py +++ b/bin/lists.rpc.py @@ -1,6 +1,6 @@ #!/usr/bin/env python #*************************************************************************** -#* Copyright (C) 2003-2011 Polytechnique.org * +#* Copyright (C) 2003-2014 Polytechnique.org * #* http://opensource.polytechnique.org/ * #* * #* This program is free software; you can redistribute it and/or modify * @@ -69,6 +69,7 @@ def get_config(sec, val, default=None): MYSQL_USER = get_config('Core', 'dbuser') MYSQL_PASS = get_config('Core', 'dbpwd') +MYSQL_HOST = get_config('Core', 'dbhost') MYSQL_DB = get_config('Core', 'dbdb') PLATAL_DOMAIN = get_config('Mail', 'domain') @@ -167,7 +168,7 @@ def connectDB(): db=MYSQL_DB, user=MYSQL_USER, passwd=MYSQL_PASS, - unix_socket='/var/run/mysqld/mysqld.sock') + host=MYSQL_HOST) db.ping() db.autocommit(True) return db.cursor() @@ -202,7 +203,7 @@ def to_forlife(email): mbox = email fqdn = PLATAL_DOMAIN if ( fqdn == PLATAL_DOMAIN ) or ( fqdn == PLATAL_DOMAIN2 ): - res = mysql_fetchone("""SELECT CONCAT(f.alias, '@%s'), a.full_name + res = mysql_fetchone("""SELECT CONCAT(s1.email, '@%s'), a.full_name FROM accounts AS a INNER JOIN email_source_account AS s1 ON (a.uid = s1.uid AND s1.type = 'forlife') INNER JOIN email_source_account AS s2 ON (a.uid = s2.uid AND s2.email = '%s') @@ -466,6 +467,8 @@ def mass_subscribe(userdesc, perms, mlist, users): @edit @admin """ + if isinstance(users, dict): + users = users.values() if not isinstance(users, list): raise Exception("userlist must be a list") members = mlist.getRegularMemberKeys()