[tor-commits] [gettor/master] Add updates for db connections

hiro at torproject.org hiro at torproject.org
Wed May 22 16:09:15 UTC 2019


commit 3726d31b4ec2fb51006b1bca9c78ad76443d2d97
Author: hiro <hiro at torproject.org>
Date:   Wed May 22 18:09:10 2019 +0200

    Add updates for db connections
---
 gettor/utils/db.py          | 8 ++++----
 tests/test_email_service.py | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/gettor/utils/db.py b/gettor/utils/db.py
index 8d65f45..73610ed 100644
--- a/gettor/utils/db.py
+++ b/gettor/utils/db.py
@@ -45,7 +45,7 @@ class SQLite3(object):
 		"""
 		Perform a new request to the database
 		"""
-		query = "INSERT INTO requests VALUES(?, ?, ?, ?, ?, ?)"
+		query = "INSERT INTO requests VALUES(?, ?, ?, ?, ?, ?, ?)"
 
 		return self.dbpool.runQuery(
 			query, (id, command, platform, language, service, date, status)
@@ -96,11 +96,11 @@ class SQLite3(object):
 			query, (now_str,platform, command, service, now_str)
 		).addCallback(self.query_callback).addErrback(self.query_errback)
 
-	def get_links(self, platform, status):
+	def get_links(self, platform, language, status):
 		"""
 		Get links from the database per platform
 		"""
-		query = "SELECT * FROM links WHERE platform=? AND status=?"
+		query = "SELECT * FROM links WHERE platform=? AND language=? AND status=?"
 		return self.dbpool.runQuery(
-			query, (platform, status)
+			query, (platform, language, status)
 		).addCallback(self.query_callback).addErrback(self.query_errback)
diff --git a/tests/test_email_service.py b/tests/test_email_service.py
index a4a7405..9abef57 100644
--- a/tests/test_email_service.py
+++ b/tests/test_email_service.py
@@ -27,7 +27,7 @@ class EmailServiceTests(unittest.TestCase):
 
     def test_language_email_parser(self):
         ep = conftests.EmailParser(self.settings, "gettor at torproject.org")
-        request = ep.parse("From: \"silvia [hiro]\" <hiro at torproject.org>\n Subject: osx en\r\n Reply-To: hiro at torproject.org \nTo: gettor at torproject.org\n osx English")
+        request = ep.parse("From: \"silvia [hiro]\" <hiro at torproject.org>\n Subject: \r\n Reply-To: hiro at torproject.org \nTo: gettor at torproject.org\n osx en")
         self.assertEqual(request["command"], "links")
         self.assertEqual(request["platform"], "osx")
         self.assertEqual(request["language"], "en")



More information about the tor-commits mailing list