<fieldset xmlns="http://www.w3.org/1999/xhtml" 
          xmlns:py="http://genshi.edgewall.org/"
          id="${id}"
          class="${css_class}"
          py:attrs="attrs" >
    <legend py:content="legend" />
    <div class="fielderror" py:if="error and show_error" py:content="error" />
    <div py:if="hidden_fields">
        <div py:for="field in hidden_fields"
             py:with="error=error_for(field)"
             py:strip="True">
            <span py:replace="field.display(value_for(field), **args_for(field))" />
            <span py:if="show_children_errors and error and not field.show_error" 
                  class="fielderror" py:content="error" />
        </div>
    </div>
    <ul class="field_list" py:attrs="list_attrs">
        <li py:for="i, field in enumerate(fields)" 
            id="${field.id}_container"
            class="${i%2 and 'odd' or 'even'}"
            title="${hover_help and help_text or ''}"
            py:attrs="args_for(field).get('container_attrs') or field.container_attrs"
            py:with="required=[None,' required'][int(field.is_required)]; 
                     error=error_for(field);
                     label_text = field.label_text;
                     help_text = field.help_text;" >
            
            <label py:if="show_labels and label_text and not field.suppress_label" id="${field.id}_label" for="${field.id}" 
                   class="fieldlabel${required}" py:content="label_text" />
            ${field.display(value_for(field), **args_for(field))}
            <span py:if="help_text and not hover_help" class="fieldhelp" py:content="help_text" />
            <span py:if="show_children_errors and error and not field.show_error" class="fielderror" py:content="error" />
        </li>
    </ul>
    <span py:if="error and not error.error_dict" class="fielderror" py:content="error" />
</fieldset>
