## -*- coding: utf-8 -*- <% len_attr = len(attributes) switch = len_attr / 2 if not switch * 2 == len_attr: switch = switch + 1 counter = 1 lc1 = [] lc2 = [] for a in sorted(attributes.keys(), key=lambda attr: attributes[attr]['weight']): if counter <= switch: lc1.append(a) else: lc2.append(a) counter = counter + 1 %> <%def name="form_col(l)"> % for a in l: <% attr = attributes[a] %>
<% if modify: required = '' else: required = ' required ' if not values is None and a in values: if type(values[a]) is list: tmp = values[a][0] else: tmp = values[a] value = ' value="'+ tmp + '"' value2 = '' else: value = '' value2 = '' %> ${attr['display_name']} % if modify and a == keyattr: ${tmp} % elif attr['type'] == 'string': % elif attr['type'] == 'email': % elif attr['type'] == 'int': % elif attr['type'] == 'fix': ${attr['value']} % elif attr['type'] == 'stringlist': % elif attr['type'] == 'password': Retype ${attr['display_name']} % endif
% endfor
${form_col(lc1)}
${form_col(lc2)}