From d9dbe4fb1ebbf4c5d26b151509acc4ce30654b8d Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Wed, 6 Mar 2013 20:43:09 -0600 Subject: Add family property to mirror check location Signed-off-by: Dan McGee --- mirrors/models.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'mirrors') 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") -- cgit v1.2.3-24-g4f1b