(self)
keys = web.get_form_keys()
        for key in keys:
            value = web.get_form_value(key)
            if not value:
                continue

            value = value.strip()

            if key.startswith("bg_color|"):
                prefix, name = key.split("|")
                bg_colors.append( [name, value] )
            elif key.startswith("text_color|"):
                prefix, name = key.split("|")
                text_colors.append( [name, value] )
keys = web.get_form_keys()
        for key in keys:
            value = web.get_form_value(key)
            if not value:
                continue
keys = web . get_form_keys () for key in keys : value = web . get_form_value ( key ) if not value : continue
def save_color(self):
        web = WebContainer.get_web()

        search = Search("config/widget_config")
        search.add_filter("search_type", self.search_type)
        search.add_filter("view", "color")
        config = search.get_sobject()
        if not config:
            config = SearchType.create("config/widget_config")
            config.set_value("search_type", self.search_type)
            config.set_value("view", "color")
            config.set_value("config", "<config><color/></config>")
            config.set_view("color")
            config._init()


        bg_colors = [];
        text_colors = []


        columns = web.get_form_values("color|column")
        bg_color_list = web.get_form_values("bg_color")
        text_color_list = web.get_form_values("text_color")
        for i, column in enumerate(columns):
            color = bg_color_list[i]
            # color is empty from the template row
            if column == '' or color == '':
                continue
            bg_colors.append( [column, color] )
            #text_colors.append( [column, text_color_list[i]] )

        '''
        keys = web.get_form_keys()
        for key in keys:
            value = web.get_form_value(key)
            if not value:
                continue

            value = value.strip()

            if key.startswith("bg_color|"):
                prefix, name = key.split("|")
                bg_colors.append( [name, value] )
            elif key.startswith("text_color|"):
                prefix, name = key.split("|")
                text_colors.append( [name, value] )
        '''
 
        element_xml = []
        element_xml.append( '''<element name='%s'>''' % self.element_name )



        # bg colors
        if bg_colors:
            element_xml.append( '''  <colors>''')
            for name, value in bg_colors:
                element_xml.append( '''    <value name="%s">%s</value>''' % (name,value) )
            element_xml.append( '''  </colors>''')

        # text colors
        if text_colors:
            element_xml.append( '''  <text_colors>''')
            for name, value in text_colors:
                element_xml.append( '''    <value name="%s">%s</value>''' % (name,value) )
            element_xml.append( '''  </text_colors>''')

        element_xml.append( '''</element>''' )

        element_xml = "\n".join(element_xml)


        config.append_xml_element(self.element_name, element_xml)
        config.commit_config()
def save_color ( self ) : web = WebContainer . get_web ( ) search = Search ( "config/widget_config" ) search . add_filter ( "search_type" , self . search_type ) search . add_filter ( "view" , "color" ) config = search . get_sobject ( ) if not config : config = SearchType . create ( "config/widget_config" ) config . set_value ( "search_type" , self . search_type ) config . set_value ( "view" , "color" ) config . set_value ( "config" , "<config><color/></config>" ) config . set_view ( "color" ) config . _init ( ) bg_colors = [ ] text_colors = [ ] columns = web . get_form_values ( "color|column" ) bg_color_list = web . get_form_values ( "bg_color" ) text_color_list = web . get_form_values ( "text_color" ) for i , column in enumerate ( columns ) : color = bg_color_list [ i ] # color is empty from the template row if column == '' or color == '' : continue bg_colors . append ( [ column , color ] ) #text_colors.append( [column, text_color_list[i]] ) element_xml = [ ] element_xml . append ( '''<element name='%s'>''' % self . element_name ) # bg colors if bg_colors : element_xml . append ( '''  <colors>''' ) for name , value in bg_colors : element_xml . append ( '''    <value name="%s">%s</value>''' % ( name , value ) ) element_xml . append ( '''  </colors>''' ) # text colors if text_colors : element_xml . append ( '''  <text_colors>''' ) for name , value in text_colors : element_xml . append ( '''    <value name="%s">%s</value>''' % ( name , value ) ) element_xml . append ( '''  </text_colors>''' ) element_xml . append ( '''</element>''' ) element_xml = "\n" . join ( element_xml ) config . append_xml_element ( self . element_name , element_xml ) config . commit_config ( )