Exemple #1
0
    def select_by_name(self, name):
        return self.select_from_row(self.row_by_name(name))


@fill.method((AssignFormTable, Mapping))
def _fill_assignform_dict(form, d):
    d = copy(d)  # Mutable
    for name, value in d.iteritems():
        if value is None:
            value = "<Nothing>"
        select = form.select_by_name(name)
        sel.select(select, value)


assign_form = Form(fields=[
    ("assign_to", Select_old("select#cbshow_typ")),
    # Enterprise
    ("enterprise",
     Select_old("select#enterprise__1")),  # Simple shotcut, might explode once
    # Tagged DS
    ("tag_category", Select_old("select#cbtag_cat")),
    # Docker Labels
    ("docker_labels", Select_old('select#cblabel_key')),
    # Common - selection table
    ("selections",
     AssignFormTable({
         LOWEST:
         ("//div[@id='cb_assignment_div']/fieldset/table[contains(@class, 'style1')]"
          "/tbody/tr/td/table"),
         "5.4":
         "//div[@id='cb_assignment_div']/table[contains(@class, 'table')]",
Exemple #2
0
 def select_from_row(self, row):
     el = pick({"5.6": "./td/select", "5.7": "./td/div/select"})
     return Select_old(sel.element(el, root=row))
Exemple #3
0
        return self.select_from_row(self.row_by_name(name))


@fill.method((AssignFormTable, Mapping))
def _fill_assignform_dict(form, d):
    d = copy(d)  # Mutable
    for name, value in d.iteritems():
        if value is None:
            value = "<Nothing>"
        select = form.select_by_name(name)
        sel.select(select, value)


assign_form = Form(
    fields=[
        ("assign_to", Select_old("select#cbshow_typ")),
        # Enterprise
        ("enterprise", Select_old("select#enterprise__1")),  # Simple shotcut, might explode once
        # Tagged DS
        ("tag_category", Select_old("select#cbtag_cat")),
        # Common - selection table
        ("selections", AssignFormTable({
            LOWEST: (
                "//div[@id='cb_assignment_div']/fieldset/table[contains(@class, 'style1')]"
                "/tbody/tr/td/table"),
            "5.4": "//div[@id='cb_assignment_div']/table[contains(@class, 'table')]",
        })),
        ('save_button', form_buttons.save)])


class ComputeRate(Updateable, Pretty, Navigatable):