summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2013-03-07 03:43:09 +0100
committerDan McGee <dan@archlinux.org>2013-03-07 03:43:09 +0100
commitd9dbe4fb1ebbf4c5d26b151509acc4ce30654b8d (patch)
treec3f76cc8a1e0d6a10204559246b95f369eb2226d
parent3e0209f5e8ee197034b6c1f705af515d8154801b (diff)
downloadarchweb-d9dbe4fb1ebbf4c5d26b151509acc4ce30654b8d.tar.gz
archweb-d9dbe4fb1ebbf4c5d26b151509acc4ce30654b8d.tar.xz
Add family property to mirror check location
Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r--mirrors/models.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/mirrors/models.py b/mirrors/models.py
index c205fef..07ac1e6 100644
--- a/mirrors/models.py
+++ b/mirrors/models.py
@@ -129,6 +129,13 @@ class CheckLocation(models.Model):
def __unicode__(self):
return self.hostname
+ @property
+ def family(self):
+ info = socket.getaddrinfo(self.source_ip, None, 0, 0, 0,
+ socket.AI_NUMERICHOST)
+ families = [x[0] for x in info]
+ return families[0]
+
class MirrorLog(models.Model):
url = models.ForeignKey(MirrorUrl, related_name="logs")