Code

Allow 'no value' to be selected in LinkHTMLProperty.menu()
authorstefan <stefan@57a73879-2fb5-44c3-a270-3262357dd7e2>
Mon, 16 Feb 2009 21:26:29 +0000 (21:26 +0000)
committerstefan <stefan@57a73879-2fb5-44c3-a270-3262357dd7e2>
Mon, 16 Feb 2009 21:26:29 +0000 (21:26 +0000)
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/roundup/trunk@4135 57a73879-2fb5-44c3-a270-3262357dd7e2

roundup/cgi/templating.py

index 73459f4dccc9f5af7b5cb97dcd6426057122292c..12120e916e5b5a836d75dcb929cf0dc8fcb94f9b 100644 (file)
@@ -1873,8 +1873,14 @@ class LinkHTMLProperty(HTMLProperty):
         if not self.is_edit_ok():
             return self.plain(escape=1)
 
+        # Since None indicates the default, we need another way to
+        # indicate "no selection".  We use -1 for this purpose, as
+        # that is the value we use when submitting a form without the
+        # value set.
         if value is None:
             value = self._value
+        elif value == '-1':
+            value = None
 
         linkcl = self._db.getclass(self._prop.classname)
         l = ['<select name="%s">'%self._formname]