Mercurial > p > roundup > code
comparison roundup/cgi/templating.py @ 4043:32965347a663
Allow 'no value' to be selected in LinkHTMLProperty.menu()
| author | Stefan Seefeld <stefan@seefeld.name> |
|---|---|
| date | Mon, 16 Feb 2009 21:26:29 +0000 |
| parents | 8831882170fc |
| children | 047402c4ec9b |
comparison
equal
deleted
inserted
replaced
| 4042:8831882170fc | 4043:32965347a663 |
|---|---|
| 1871 If not editable, just display the value via plain(). | 1871 If not editable, just display the value via plain(). |
| 1872 """ | 1872 """ |
| 1873 if not self.is_edit_ok(): | 1873 if not self.is_edit_ok(): |
| 1874 return self.plain(escape=1) | 1874 return self.plain(escape=1) |
| 1875 | 1875 |
| 1876 # Since None indicates the default, we need another way to | |
| 1877 # indicate "no selection". We use -1 for this purpose, as | |
| 1878 # that is the value we use when submitting a form without the | |
| 1879 # value set. | |
| 1876 if value is None: | 1880 if value is None: |
| 1877 value = self._value | 1881 value = self._value |
| 1882 elif value == '-1': | |
| 1883 value = None | |
| 1878 | 1884 |
| 1879 linkcl = self._db.getclass(self._prop.classname) | 1885 linkcl = self._db.getclass(self._prop.classname) |
| 1880 l = ['<select name="%s">'%self._formname] | 1886 l = ['<select name="%s">'%self._formname] |
| 1881 k = linkcl.labelprop(1) | 1887 k = linkcl.labelprop(1) |
| 1882 s = '' | 1888 s = '' |
