Ignore:
Timestamp:
Jul 30, 2008, 10:13:02 PM (16 years ago)
Author:
price
Message:

use yaml.CSafeDumper and yaml.CSafeLoader everywhere

also break some long lines to fit in 80 columns

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  
    3535        @with_lock_file(lock_file, False)
    3636        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()))
    3839            except: ns.do_refresh = True
    3940
     
    4546        def refresh_cache():
    4647            import yaml
    47             try:    default_loader = yaml.CSafeLoader
    48             except: default_loader = yaml.SafeLoader
    49             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)))
    5152            except: pass # silent failure
    5253    return ns.cfg
Note: See TracChangeset for help on using the changeset viewer.