From aef52ff6e4b6bbe562a356d18dcd36efe2c2876d Mon Sep 17 00:00:00 2001 From: Shawn Wilkinson Date: Mon, 21 Sep 2015 12:52:41 -0400 Subject: [PATCH] Small PEP8 Fixes --- dataserv/app.py | 4 +++- dataserv/config.py | 1 - tests/test_App.py | 1 - 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dataserv/app.py b/dataserv/app.py index a5ace8e..b7add67 100644 --- a/dataserv/app.py +++ b/dataserv/app.py @@ -41,7 +41,7 @@ def online_farmers(): # give us all farmers that have been around for the past online_time q = db.session.query(Farmer) q = q.filter(Farmer.last_seen > time_ago) - q = q.order_by(desc(Farmer.height),Farmer.id) + q = q.order_by(desc(Farmer.height), Farmer.id) return q.all() @@ -90,8 +90,10 @@ def ping(btc_addr): error_msg = "Ping Failed: {0}" try: user = Farmer(btc_addr) + def before_commit(): # lazy authentication user.authenticate(dict(request.headers)) + user.ping(before_commit_callback=before_commit) return make_response("Ping accepted.", 200) except ValueError: diff --git a/dataserv/config.py b/dataserv/config.py index 89dc82a..7b8b34f 100644 --- a/dataserv/config.py +++ b/dataserv/config.py @@ -2,7 +2,6 @@ import logging - ONLINE_TIME = 5 # minutes diff --git a/tests/test_App.py b/tests/test_App.py index 29d6961..afb7175 100644 --- a/tests/test_App.py +++ b/tests/test_App.py @@ -143,7 +143,6 @@ def test_ping_invalid_address(self): self.assertEqual(rv.status_code, 400) - class OnlineTest(TemplateTest): def test_online(self):