Changeset 8302 in genesis for nodes


Ignore:
Timestamp:
Aug 10, 2010, 6:21:06 PM (14 years ago)
Author:
rick
Message:

Cache broke

File:
1 edited

Legend:

Unmodified
Added
Removed
  • nodes/make-map.py

    r8296 r8302  
    6060def rd2etrs(xrd, yrd, hnap=0.0):
    6161  """ Convert rd to etrs """
     62  # Get cache is exists
    6263  global coordinates
    63   xrd = float(str(xrd))
    64   yrd = float(str(yrd))
    6564  if coordinates == None:
    6665    try:
    6766      coordinates = get_yaml(CACHE_FILE)
    68       if coordinates.has_key((xrd, yrd)):
    69        return coordinates[(xrd, yrd)]
    7067    except (IOError,AttributeError):
    7168      coordinates = dict()
    7269      pass
    7370
     71  # Check if item in cache
     72  xrd = float(str(xrd))
     73  yrd = float(str(yrd))
     74  if coordinates.has_key((xrd, yrd)):
     75    return coordinates[(xrd, yrd)]
     76
     77  # Get new coordinate
    7478  item = dict()
    7579  item['xrd'] = xrd
     
    7983  args = "&".join(["%s=%s" % (k,v) for k,v in item.iteritems()])
    8084  url = 'http://www.rdnap.nl/cgi-bin/rdetrs.pl?%s' % args
    81   print "### Fetching coordinate %s, %s from %s" % (xrd, yrd, url)
     85  print "### Not in Cache, Fetching coordinate %s, %s from %s" % (xrd, yrd, url)
    8286  f = urllib.urlopen(url)
    8387  raw = f.read()
Note: See TracChangeset for help on using the changeset viewer.