web/propertysheet.py
changeset 5467 57372dbfd114
parent 5466 b5af2ac0c43c
child 5938 9cb13d1b2ce4
equal deleted inserted replaced
5466:b5af2ac0c43c 5467:57372dbfd114
    25 
    25 
    26 
    26 
    27 class PropertySheet(dict):
    27 class PropertySheet(dict):
    28     def __init__(self, cache_directory, **context):
    28     def __init__(self, cache_directory, **context):
    29         self._cache_directory = cache_directory
    29         self._cache_directory = cache_directory
    30         self._context = context
    30         self.context = context
    31         self.reset()
    31         self.reset()
    32         context['sheet'] = self
    32         context['sheet'] = self
    33         self._percent_rgx = re.compile('%(?!\()')
    33         self._percent_rgx = re.compile('%(?!\()')
    34 
    34 
    35     def reset(self):
    35     def reset(self):
    38         self._propfile_mtime = {}
    38         self._propfile_mtime = {}
    39         self._sourcefile_mtime = {}
    39         self._sourcefile_mtime = {}
    40         self._cache = {}
    40         self._cache = {}
    41 
    41 
    42     def load(self, fpath):
    42     def load(self, fpath):
    43         scriptglobals = self._context.copy()
    43         scriptglobals = self.context.copy()
    44         scriptglobals['__file__'] = fpath
    44         scriptglobals['__file__'] = fpath
    45         execfile(fpath, scriptglobals, self)
    45         execfile(fpath, scriptglobals, self)
    46         self._propfile_mtime[fpath] = os.stat(fpath)[-2]
    46         self._propfile_mtime[fpath] = os.stat(fpath)[-2]
    47         self._ordered_propfiles.append(fpath)
    47         self._ordered_propfiles.append(fpath)
    48 
    48