summaryrefslogtreecommitdiff
path: root/mirrors
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2013-03-06 20:43:09 -0600
committerDan McGee <dan@archlinux.org>2013-03-06 20:43:09 -0600
commitd9dbe4fb1ebbf4c5d26b151509acc4ce30654b8d (patch)
treec3f76cc8a1e0d6a10204559246b95f369eb2226d /mirrors
parent3e0209f5e8ee197034b6c1f705af515d8154801b (diff)
Add family property to mirror check location
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'mirrors')
-rw-r--r--mirrors/models.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/mirrors/models.py b/mirrors/models.py
index c205fef2..07ac1e6e 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")