コード例 #1
0
    def _get_file_and_new_contents(self, key):
        filename = self.manifest.get(key)
        contents = None
        if filename and os.path.exists(filename):
            return os.path.join(self.cachedir, filename), None

        fileroot = self._key_to_file(key)
        filename = os.path.join(self.cachedir, fileroot)
        with open(filename, 'wb') as f:
            contents = self._get_file_contents(key)
            f.write(contents)

        self.manifest[key] = fileroot
        Yaml.write(self.manifest_file, self.manifest)
        return filename, contents
コード例 #2
0
ファイル: Cache.py プロジェクト: TopRamenGod/echomesh
    def _get_file_and_new_contents(self, key):
        filename = self.manifest.get(key)
        contents = None
        if filename and os.path.exists(filename):
            return os.path.join(self.cachedir, filename), None

        fileroot = self._key_to_file(key)
        filename = os.path.join(self.cachedir, fileroot)
        with open(filename, 'wb') as f:
            contents = self._get_file_contents(key)
            f.write(contents)

        self.manifest[key] = fileroot
        Yaml.write(self.manifest_file, self.manifest)
        return filename, contents
コード例 #3
0
ファイル: Routing.py プロジェクト: dasbavaria/echomesh
def config(_, scope, cfg):
  f = CommandFile.config_file(scope)
  configs = Yaml.read(f) + [cfg]
  Yaml.write(f, Merge.merge(*configs))
  # TODO: needs to propagate!
  LOGGER.info('Changing configuration for %s', scope)
コード例 #4
0
ファイル: Settings.py プロジェクト: sagistrauss/echomesh
def settings(_, scope, cfg):
    f = DataFile.settings_file(scope)
    settings = Yaml.read(f) + [cfg]
    Yaml.write(f, Merge.merge(*settings))
    # TODO: needs to propagate!
    LOGGER.info('Changing settings for %s', scope)
コード例 #5
0
 def _write(self):
     Yaml.write(self._filename, self)
コード例 #6
0
ファイル: PersistentDict.py プロジェクト: dasbavaria/echomesh
 def _write(self):
   Yaml.write(self._filename, self)
コード例 #7
0
ファイル: Settings.py プロジェクト: TopRamenGod/echomesh
def settings(_, scope, cfg):
    f = DataFile.settings_file(scope)
    settings = Yaml.read(f) + [cfg]
    Yaml.write(f, Merge.merge(*settings))
    # TODO: needs to propagate!
    LOGGER.info('Changing settings for %s', scope)