summaryrefslogtreecommitdiffstats
path: root/mirrors/models.py
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-04-12 18:36:20 -0500
committerDan McGee <dan@archlinux.org>2011-04-12 18:36:20 -0500
commit78a553e558217640c0efa233ac7a7037be3f34b5 (patch)
treedc042ef4ab8d52e93250e7d6b3a36b477cb86182 /mirrors/models.py
parent064813560c20f53f9fd759d0c4e0f0a6729c8ba6 (diff)
downloadarchweb-78a553e558217640c0efa233ac7a7037be3f34b5.tar.gz
archweb-78a553e558217640c0efa233ac7a7037be3f34b5.zip
Add optional country override for individual mirror URLs
This allows a named top-level mirror to have geographically distributed URLs, e.g. kernel.org and the geo-DNS setup. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'mirrors/models.py')
-rw-r--r--mirrors/models.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/mirrors/models.py b/mirrors/models.py
index 80808e2e..bcde210c 100644
--- a/mirrors/models.py
+++ b/mirrors/models.py
@@ -58,6 +58,8 @@ class MirrorUrl(models.Model):
protocol = models.ForeignKey(MirrorProtocol, related_name="urls",
editable=False, on_delete=models.PROTECT)
mirror = models.ForeignKey(Mirror, related_name="urls")
+ country = models.CharField(max_length=255, blank=True, null=True,
+ db_index=True)
has_ipv4 = models.BooleanField("IPv4 capable", default=True,
editable=False)
has_ipv6 = models.BooleanField("IPv6 capable", default=False,
@@ -73,6 +75,10 @@ class MirrorUrl(models.Model):
def hostname(self):
return urlparse(self.url).hostname
+ @property
+ def real_country(self):
+ return self.country or self.mirror.country
+
def clean(self):
try:
# Auto-map the protocol field by looking at the URL