summaryrefslogtreecommitdiff
path: root/mirrors/management/commands/mirrorcheck.py
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2012-12-12 18:01:59 -0500
committerLuke Shumaker <LukeShu@sbcglobal.net>2012-12-12 18:01:59 -0500
commit764182c0ca66b538cef994409f04f876681598cd (patch)
tree2f399c618484c00f84875b437f3fcfcc9c509424 /mirrors/management/commands/mirrorcheck.py
parent8844fd0c6361d3a6ccd88647276e9af0e6cd64d2 (diff)
parent822898e57bc6d4e008ef58da309857e9ef8c98e6 (diff)
Merge commit '822898e' (Merge branch 'django14')
Conflicts: requirements.txt requirements_prod.txt templates/base.html templates/devel/clock.html templates/public/download.html templates/public/index.html templates/releng/results.html
Diffstat (limited to 'mirrors/management/commands/mirrorcheck.py')
-rw-r--r--mirrors/management/commands/mirrorcheck.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/mirrors/management/commands/mirrorcheck.py b/mirrors/management/commands/mirrorcheck.py
index 8eb8b010..c2928e67 100644
--- a/mirrors/management/commands/mirrorcheck.py
+++ b/mirrors/management/commands/mirrorcheck.py
@@ -21,9 +21,11 @@ import sys
import time
from threading import Thread
import types
+from pytz import utc
from Queue import Queue, Empty
import urllib2
+from main.utils import utc_now
from mirrors.models import MirrorUrl, MirrorLog
logging.basicConfig(
@@ -50,7 +52,7 @@ class Command(NoArgsCommand):
def check_mirror_url(mirror_url):
url = mirror_url.url + 'lastsync'
logger.info("checking URL %s", url)
- log = MirrorLog(url=mirror_url, check_time=datetime.utcnow())
+ log = MirrorLog(url=mirror_url, check_time=utc_now())
try:
start = time.time()
result = urllib2.urlopen(url, timeout=10)
@@ -61,6 +63,7 @@ def check_mirror_url(mirror_url):
parsed_time = None
try:
parsed_time = datetime.utcfromtimestamp(int(data))
+ parsed_time = parsed_time.replace(tzinfo=utc)
except ValueError:
# it is bad news to try logging the lastsync value;
# sometimes we get a crazy-encoded web page.