| Index: sitescripts/reports/utils.py |
| =================================================================== |
| --- a/sitescripts/reports/utils.py |
| +++ b/sitescripts/reports/utils.py |
| @@ -16,7 +16,7 @@ |
| # along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
| import hashlib, hmac, base64, MySQLdb, os, re, marshal, subprocess |
| -from sitescripts.utils import get_config, cached, get_template, sendMail |
| +from sitescripts.utils import get_config, cached, get_template, anonymizeMail, sendMail |
| def getReportSubscriptions(guid): |
| cursor = get_db().cursor(MySQLdb.cursors.DictCursor) |
| @@ -102,6 +102,13 @@ |
| get_db().commit() |
| reportData['guid'] = guid |
| + if contact: |
|
Wladimir Palant
2012/11/07 08:38:15
What if there is an email field but no contact? Th
Andrey Novikov
2012/11/07 09:38:48
Few lines above we have:
contact = getUserId(repor
|
| + email = reportData['email'] |
| + email = re.sub(r' at ', r'@', email) |
| + email = re.sub(r' dot ', r'.', email) |
| + reportData['email'] = anonymizeMail(email) |
| + reportData['uid'] = contact |
| + |
| file = os.path.join(get_config().get('reports', 'dataPath'), guid[0], guid[1], guid[2], guid[3], guid + '.html') |
| dir = os.path.dirname(file) |
| if not os.path.exists(dir): |
| @@ -122,6 +129,14 @@ |
| if os.path.isfile(file): |
| os.remove(file) |
| +def getUser(contact): |
| + cursor = get_db().cursor(MySQLdb.cursors.DictCursor) |
| + executeQuery(cursor, |
| + '''SELECT reports, positive, negative FROM #PFX#users WHERE id = %s''', |
| + (contact)) |
| + user = cursor.fetchone() |
| + return user |
| + |
| @cached(3600) |
| def getUserUsefulnessScore(contact): |
| if contact == None: |