Return item by name or label, disambiguating if necessary with nr. All arguments must be passed by name, with the exception of 'name', which may be used as a positional argument. If name is specified, then the item must have the indicated name. If label is specifie
(self, name=None, label=None, id=None, nr=None,
exclude_disabled=False)
| 1851 | return items |
| 1852 | |
| 1853 | def get(self, name=None, label=None, id=None, nr=None, |
| 1854 | exclude_disabled=False): |
| 1855 | """Return item by name or label, disambiguating if necessary with nr. |
| 1856 | |
| 1857 | All arguments must be passed by name, with the exception of 'name', |
| 1858 | which may be used as a positional argument. |
| 1859 | |
| 1860 | If name is specified, then the item must have the indicated name. |
| 1861 | |
| 1862 | If label is specified, then the item must have a label whose |
| 1863 | whitespace-compressed, stripped, text substring-matches the indicated |
| 1864 | label string (eg. label="please choose" will match |
| 1865 | " Do please choose an item "). |
| 1866 | |
| 1867 | If id is specified, then the item must have the indicated id. |
| 1868 | |
| 1869 | nr is an optional 0-based index of the items matching the query. |
| 1870 | |
| 1871 | If nr is the default None value and more than item is found, raises |
| 1872 | AmbiguityError (unless the HTMLForm instance's backwards_compat |
| 1873 | attribute is true). |
| 1874 | |
| 1875 | If no item is found, or if items are found but nr is specified and not |
| 1876 | found, raises ItemNotFoundError. |
| 1877 | |
| 1878 | Optionally excludes disabled items. |
| 1879 | |
| 1880 | """ |
| 1881 | if nr is None and self._form.backwards_compat: |
| 1882 | nr = 0 # :-/ |
| 1883 | items = self.get_items(name, label, id, exclude_disabled) |
| 1884 | return disambiguate(items, nr, name=name, label=label, id=id) |
| 1885 | |
| 1886 | def _get(self, name, by_label=False, nr=None, exclude_disabled=False): |
| 1887 | # strictly for use by deprecated methods |
no test coverage detected