Beispiel #1
0
 def write_object_list(self, seq, group_name):
     """Write object sequence in group.
     Objects must implement the DataSet-like `serialize` method"""
     with self.group(group_name):
         if seq is None:
             self.write_none()
         else:
             ids = []
             for obj in seq:
                 guid = to_binary_string(str(uuid1()))
                 ids.append(guid)
                 with self.group(guid):
                     if obj is None:
                         self.write_none()
                     else:
                         obj.serialize(self)
             self.write(ids, 'IDs')
Beispiel #2
0
 def write_object_list(self, seq, group_name):
     """Write object sequence in group.
     Objects must implement the DataSet-like `serialize` method"""
     with self.group(group_name):
         if seq is None:
             self.write_none()
         else:
             ids = []
             for obj in seq:
                 guid = to_binary_string(str(uuid1()))
                 ids.append(guid)
                 with self.group(guid):
                     if obj is None:
                         self.write_none()
                     else:
                         obj.serialize(self)
             self.write(ids, 'IDs')
Beispiel #3
0
 def add_text_data_file(self, filename, contents):
     """Create temporary data file *filename* with *contents*
     and add it to *data_files*"""
     open(filename, 'wb').write(to_binary_string(contents))
     self.data_files += [("", (filename, ))]
     _remove_later(filename)
Beispiel #4
0
 def add_text_data_file(self, filename, contents):
     """Create temporary data file *filename* with *contents*
     and add it to *data_files*"""
     open(filename, 'wb').write(to_binary_string(contents))
     self.data_files += [("", (filename, ))]
     _remove_later(filename)