From 1258d8a0937e9966156ae31466c14d54162a6adb Mon Sep 17 00:00:00 2001 From: Jonas Braathen Date: Sat, 9 Aug 2014 04:52:05 +0200 Subject: [PATCH] Now with less repetition of column names. --- tekstmelding.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/tekstmelding.py b/tekstmelding.py index 6a2dec1..9b512f7 100644 --- a/tekstmelding.py +++ b/tekstmelding.py @@ -66,21 +66,23 @@ def get_user_by_phone(number): [number], one=True) return user -def log_incoming(userid, gsm, codeword, message, operator, shortno, action, ip, simulation): +def log_incoming(**kwargs): + app.logger.debug(kwargs) return query_db(""" INSERT INTO din_sms_received (userid, gsm, codeword, message, operator, shortno, action, IP, simulation) VALUES - (%s, %s, %s, %s, %s, %s, %s, %s, %s) - """, [userid, gsm, codeword, message, operator, shortno, action, ip, simulation], lastrowid=True) + (%(userid)s, %(gsm)s, %(codeword)s, %(message)s, %(operator)s, %(shortno)s, %(action)s, %(ip)s, %(simulation)s) + """, kwargs, lastrowid=True) -def log_sent(response_to, msgid, sender, receiver, countrycode, message, operator, codeword, billing_price, use_dlr, simulation, activation_code): +def log_sent(**kwargs): query_db(""" INSERT INTO din_sms_sent (response_to, msgid, sender, receiver, countrycode, message, operator, codeword, billing_price, use_dlr, simulation, activation_code) VALUES - (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s) - """, [response_to, msgid, sender, receiver, countrycode, message, operator, codeword, billing_price, use_dlr, simulation, activation_code]) + (%(response_to)s, %(msgid)s, %(sender)s, %(receiver)s, %(countrycode)s, %(message)s, + %(operator)s, %(codeword)s, %(billing_price)s, %(use_dlr)s, %(simulation)s, %(activation_code)s) + """, kwargs) @app.route('/') def main():