示例#1
0
 def commit(self):
     if hasattr(self, 'file_path') and self.file_path:
         if not os.path.exists(self.file_path):
             make_config_dir()
         with ExclusiveFile(self.file_path) as f:
             raw = cPickle.dumps(self, -1)
             f.seek(0)
             f.truncate()
             f.write(raw)
示例#2
0
 def commit(self):
     if hasattr(self, 'file_path') and self.file_path:
         if not os.path.exists(self.file_path):
             make_config_dir()
         with ExclusiveFile(self.file_path) as f:
             raw = cPickle.dumps(self, -1)
             f.seek(0)
             f.truncate()
             f.write(raw)
示例#3
0
 def commit(self):
     if not getattr(self, 'name', None):
         return
     if not os.path.exists(self.file_path):
         make_config_dir()
     raw = json_dumps(self)
     with ExclusiveFile(self.file_path) as f:
         f.seek(0)
         f.truncate()
         f.write(raw)
示例#4
0
文件: config.py 项目: zyhong/calibre
 def commit(self):
     if not getattr(self, 'name', None):
         return
     if not os.path.exists(self.file_path):
         make_config_dir()
     raw = json_dumps(self)
     with ExclusiveFile(self.file_path) as f:
         f.seek(0)
         f.truncate()
         f.write(raw)