- Timestamp:
- Jul 30, 2008, 10:13:02 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/sipb-xen-base/files/usr/share/python-support/sipb-xen-base/invirt/config.py
r793 r796 35 35 @with_lock_file(lock_file, False) 36 36 def read_cache(): 37 try: ns.cfg = with_closing(file(cache_path))(lambda f: json.read(f.read())) 37 try: ns.cfg = with_closing(file(cache_path)) ( 38 lambda f: json.read(f.read())) 38 39 except: ns.do_refresh = True 39 40 … … 45 46 def refresh_cache(): 46 47 import yaml 47 try: default_loader = yaml.CSafeLoader48 except: default_loader = yaml.SafeLoader49 ns.cfg = with_closing(file(src_path))(lambda f: yaml.load(f, default_loader))50 try: with_closing(file(cache_path, 'w'))(lambda f: f.write(json.write(ns.cfg)))48 ns.cfg = with_closing(file(src_path)) ( 49 lambda f: yaml.load(f, yaml.CSafeLoader)) 50 try: with_closing(file(cache_path, 'w')) ( 51 lambda f: f.write(json.write(ns.cfg))) 51 52 except: pass # silent failure 52 53 return ns.cfg
Note: See TracChangeset
for help on using the changeset viewer.