def open_resource(name):
 name_parts = name.lstrip('/').split('/')
 if (os.path.pardir in name_parts):
  raise ValueError(('Bad path segment: %r' % os.path.pardir))
 cache_key = ('pytz.zoneinfo.%s.%s' % (pytz.OLSON_VERSION, name))
 zonedata = memcache.get(cache_key)
 if (zonedata is None):
  zonedata = get_zoneinfo().read(('zoneinfo/' + '/'.join(name_parts)))
  memcache.add(cache_key, zonedata)
  logging.info(('Added timezone to memcache: %s' % cache_key))
 else:
  logging.info(('Loaded timezone from memcache: %s' % cache_key))
 return StringIO(zonedata)

def open_resource ( name ) : name_parts = name . lstrip ( '/' ) . split ( '/' ) if ( os . path . pardir in name_parts ) : raise ValueError ( ( 'Bad path segment: %r' % os . path . pardir ) ) cache_key = ( 'pytz.zoneinfo.%s.%s' % ( pytz . OLSON_VERSION , name ) ) zonedata = memcache . get ( cache_key ) if ( zonedata is None ) : zonedata = get_zoneinfo ( ) . read ( ( 'zoneinfo/' + '/' . join ( name_parts ) ) ) memcache . add ( cache_key , zonedata ) logging . info ( ( 'Added timezone to memcache: %s' % cache_key ) ) else : logging . info ( ( 'Loaded timezone from memcache: %s' % cache_key ) ) return StringIO ( zonedata )
open a resource from the zoneinfo subdir for reading .