Get the named/indexed field object, or ``default`` if no field is found. Throws an AssertionError if no field is found and no ``default`` was given.
(self, name, index=None, default=utils.NoDefault)
| 580 | field.value = value |
| 581 | |
| 582 | def get(self, name, index=None, default=utils.NoDefault): |
| 583 | """ |
| 584 | Get the named/indexed field object, or ``default`` if no field is |
| 585 | found. Throws an AssertionError if no field is found and no ``default`` |
| 586 | was given. |
| 587 | """ |
| 588 | fields = self.fields.get(name) |
| 589 | if fields is None: |
| 590 | if default is utils.NoDefault: |
| 591 | raise AssertionError( |
| 592 | "No fields found matching %r (and no default given)" |
| 593 | % name) |
| 594 | return default |
| 595 | if index is None: |
| 596 | return self[name] |
| 597 | return fields[index] |
| 598 | |
| 599 | def select(self, name, value=None, text=None, index=None): |
| 600 | """Like ``.set()``, except also confirms the target is a ``<select>`` |
no outgoing calls