]> git.ipfire.org Git - ipfire.org.git/commitdiff
Lots of smaller bug fixes.
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 29 Dec 2013 21:06:04 +0000 (22:06 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 29 Dec 2013 21:06:04 +0000 (22:06 +0100)
webapp/backend/database.py
webapp/backend/mirrors.py
webapp/backend/releases.py
webapp/backend/tracker.py
webapp/handlers_rss.py
webapp/handlers_stasy.py
webapp/handlers_tracker.py

index d2964d301670f3155c66ced26096354807171c6d..77a87bb63bdf89c986e8e2c46076fbff1075cfaf 100644 (file)
@@ -71,6 +71,9 @@ class Connection(object):
                self._db = psycopg2.connect(**self._db_args)
                self._db.autocommit = True
 
+               # Initialize the timezone setting.
+               self.execute("SET TIMEZONE TO 'UTC'")
+
        def query(self, query, *parameters, **kwparameters):
                """
                        Returns a row list for the given query and parameters.
index 265e5160b82994f1a18d7b12d037822a372611f5..b276a8091cdd446963dd37bbded48e2f77e6f77e 100644 (file)
@@ -474,7 +474,7 @@ class Mirror(Object):
                except ValueError:
                        timestamp = 0
 
-               timestamp = datetime.datetime.fromtimestamp(timestamp)
+               timestamp = datetime.datetime.utcfromtimestamp(timestamp)
 
                self.db.execute("UPDATE mirrors SET last_update = %s WHERE id = %s",
                        timestamp, self.id)
@@ -594,7 +594,7 @@ class Mirror(Object):
 
        @property
        def development(self):
-               return self._info.get("development", False)
+               return self._info.get("mirrorlist_devel", False)
 
        @property
        def mirrorlist(self):
index 64bed28818d3f19f84d761df35eed85789ad95e9..929f5b980b7ccd7e8f1e46b7f46fa422f6a50fbd 100644 (file)
@@ -438,7 +438,7 @@ class Releases(Object):
                if not file:
                        return
 
-               release = Release(file.releases)
-               file = File(release, file.id)
+               release = Release(self.backend, file.releases)
+               file = File(self.backend, release, file.id)
 
                return file
index 24a763b22937a98de76a70584afbc3f2ea47bd48..7b82478a5f215153dbebadae78b556cf8c44f77b 100644 (file)
@@ -76,7 +76,7 @@ class Tracker(Object):
                                        peer6["peer id"] = row.id
 
                                if peer4:
-                                       peer6["peer id"] = row.id
+                                       peer4["peer id"] = row.id
 
                        if peer6:
                                peers.append(peer6)
@@ -91,7 +91,7 @@ class Tracker(Object):
                        Remove all peers that have timed out.
                """
                self.db.execute("DELETE FROM tracker \
-                       WHERE last_update < NOW() - INTERVAL '%ss'", self.interval)
+                       WHERE last_update < NOW() - INTERVAL '%ss'", self.interval + 600)
 
        def update_peer(self, peer_id, info_hash, address6=None, port6=None,
                        address4=None, port4=None, downloaded=None, uploaded=None, left_data=None):
@@ -186,12 +186,13 @@ class Tracker(Object):
                        }
                }
 
-               for info_hash in info_hashes:
-                       ret["files"][info_hash] = {
-                               "complete"   : self.complete(info_hash),
-                               "incomplete" : self.incomplete(info_hash),
-                               "downloaded" : 0,
-                       }
+               if info_hashes:
+                       for info_hash in info_hashes:
+                               ret["files"][info_hash] = {
+                                       "complete"   : self.complete(info_hash),
+                                       "incomplete" : self.incomplete(info_hash),
+                                       "downloaded" : 0,
+                               }
 
                return ret
 
index 21ae4acb70a46b89e44426eacc40323461385b8f..0f2ac9b1e772292dbf785ded0023b4e607a38c31 100644 (file)
@@ -68,7 +68,7 @@ class RSSNewsHandler(RSSHandler):
                        item = tornado.database.Row({
                                "title"     : n.title,
                                "author"    : n.author,
-                               "published" : n.date,
+                               "published" : n.published,
                                "url"       : "http://www.ipfire.org/news/%s" % n.slug,
                                "markup"    : n.text,
                        })
index d54b48737574bb794a7e173a47f05a2fef341099..d384bc57d4eea838bdb5ec144f22da8d45a62b39 100644 (file)
@@ -15,10 +15,6 @@ import backend
 from handlers_base import *
 
 class StasyBaseHandler(BaseHandler):
-       @property
-       def stasy(self):
-               return backend.Stasy()
-
        def format_size(self, s):
                units = ("K", "M", "G", "T")
                unit = 0
@@ -195,7 +191,14 @@ class StasyProfileSendHandler(StasyBaseHandler):
                        if addr.is_private:
                                continue
 
-                       profile.geoip = self.geoip.get_all(remote_ip)
+                       location = self.geoip.get_location(remote_ip)
+                       if location:
+                               profile.geoip = {
+                                       "country_code" : location.country,
+                               }
+                       else:
+                               profile.geoip = None
+
                        break
 
                # Move previous profiles to archive and keep only the latest one
index ec6e626f1ed633bda4de363fd9b70b607f70af1d..27fe7fd762182c9514aff567c06e5fac36551dcb 100644 (file)
@@ -93,6 +93,9 @@ class TrackerAnnounceHandler(TrackerBaseHandler):
                # Get the external IP address of the client.
                addr = self.get_remote_ip()
 
+               if addr.startswith("172.28.1."):
+                       addr = "178.63.73.246"
+
                if not ":" in addr:
                        return addr, default_port