Example #1
0
    def append_fresh_table(self, fresh_table):
        """
        Gets called by FreshTable instances when they get written to.
        """
        if fresh_table.name:
            elements = []
            if fresh_table.is_array:
                elements += [
                    element_factory.create_array_of_tables_header_element(
                        fresh_table.name)
                ]
            else:
                elements += [
                    element_factory.create_table_header_element(
                        fresh_table.name)
                ]

            elements += [fresh_table, element_factory.create_newline_element()]
            self.append_elements(elements)

        else:
            # It's an anonymous table
            self.prepend_elements(
                [fresh_table,
                 element_factory.create_newline_element()])
 def _make_sure_table_exists(self, name_seq):
     """
     Makes sure the table with the full name comprising of name_seq exists.
     """
     t = self
     for key in name_seq[:-1]:
         t = t[key]
     name = name_seq[-1]
     if name not in t:
         self.append_elements([element_factory.create_table_header_element(name_seq),
                               element_factory.create_table({})])
Example #3
0
 def _make_sure_table_exists(self, name_seq):
     """
     Makes sure the table with the full name comprising of name_seq exists.
     """
     t = self
     for key in name_seq[:-1]:
         t = t[key]
     name = name_seq[-1]
     if name not in t:
         self.append_elements([element_factory.create_table_header_element(name_seq),
                               element_factory.create_table({})])
 def _array_make_sure_table_exists(self, array_name, index, name_seq):
     """
     Makes sure the table with the full name comprising of name_seq exists.
     """
     t = self[array_name][index]
     for key in name_seq[:-1]:
         t = t[key]
     name = name_seq[-1]
     if name not in t:
         new_table = element_factory.create_table({})
         self.append_elements([element_factory.create_table_header_element((array_name,) + name_seq), new_table])
         return new_table
Example #5
0
 def _array_make_sure_table_exists(self, array_name, index, name_seq):
     """
     Makes sure the table with the full name comprising of name_seq exists.
     """
     t = self[array_name][index]
     for key in name_seq[:-1]:
         t = t[key]
     name = name_seq[-1]
     if name not in t:
         new_table = element_factory.create_table({})
         self.append_elements([element_factory.create_table_header_element((array_name,) + name_seq), new_table])
         return new_table
    def append_fresh_table(self, fresh_table):
        """
        Gets called by FreshTable instances when they get written to.
        """
        if fresh_table.name:
            elements = []
            if fresh_table.is_array:
                elements += [element_factory.create_array_of_tables_header_element(fresh_table.name)]
            else:
                elements += [element_factory.create_table_header_element(fresh_table.name)]

            elements += [fresh_table, element_factory.create_newline_element()]
            self.append_elements(elements)

        else:
            # It's an anonymous table
            self.prepend_elements([fresh_table, element_factory.create_newline_element()])