Exemplo n.º 1
0
 def save_temporary(self, obj):
     """ Writes a backup file to disk
     """
     temp_fname = self.encode_name(self.get_temp_basename())
     new_temp_fname = temp_fname + '.tmp'
     # Write a temporary backup before deleting the old one
     io.save_to_xml(obj, new_temp_fname)
     if os.path.isfile(temp_fname):
         os.unlink(temp_fname)
     os.rename(new_temp_fname, temp_fname)
Exemplo n.º 2
0
 def save(self, obj, do_copy=True, version=None):
     is_bundle = False
     if type(obj) == type(SaveBundle(None)):
         is_bundle = True
         save_bundle = obj
         obj = save_bundle.get_primary_obj()
     obj = io.save_to_xml(obj, self._name, version)
     obj.locator = self
     # Only remove the temporaries if save succeeded!
     self.clean_temporaries()
     if is_bundle:
         return SaveBundle(save_bundle.bundle_type, obj)
     return obj
Exemplo n.º 3
0
 def save(self, obj, do_copy=True, version=None):
     is_bundle = False
     if type(obj) == type(SaveBundle(None)):
         is_bundle = True
         save_bundle = obj
         obj = save_bundle.get_primary_obj()
     obj = io.save_to_xml(obj, self._name, version)
     obj.locator = self
     # Only remove the temporaries if save succeeded!
     self.clean_temporaries()
     if is_bundle:
         return SaveBundle(save_bundle.bundle_type, obj)
     return obj
Exemplo n.º 4
0
 def save_temporary(self, obj):
     fname = self._find_latest_temporary()
     new_temp_fname = self._next_temporary(fname)
     io.save_to_xml(obj, new_temp_fname)
Exemplo n.º 5
0
 def save_temporary(self, obj):
     fname = self._find_latest_temporary()
     new_temp_fname = self._next_temporary(fname)
     io.save_to_xml(obj, new_temp_fname)