From: stefan Date: Thu, 19 Feb 2009 23:32:23 +0000 (+0000) Subject: Fix issue2550512 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=d0a5d2ebd7912279dacc3f6773c7af624e4f86e0;p=roundup.git Fix issue2550512 git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/roundup/trunk@4148 57a73879-2fb5-44c3-a270-3262357dd7e2 --- diff --git a/roundup/cgi/templating.py b/roundup/cgi/templating.py index f32b1e0..4fc6e5d 100644 --- a/roundup/cgi/templating.py +++ b/roundup/cgi/templating.py @@ -530,24 +530,10 @@ class HTMLClass(HTMLInputMixin, HTMLPermissions): for klass, htmlklass in propclasses: if not isinstance(prop, klass): continue - if form.has_key(item): - if isinstance(prop, hyperdb.Multilink): - value = lookupIds(self._db, prop, - handleListCGIValue(form[item]), fail_ok=1) - elif isinstance(prop, hyperdb.Link): - value = form.getfirst(item).strip() - if value: - value = lookupIds(self._db, prop, [value], - fail_ok=1)[0] - else: - value = None - else: - value = form.getfirst(item).strip() or None + if isinstance(prop, hyperdb.Multilink): + value = [] else: - if isinstance(prop, hyperdb.Multilink): - value = [] - else: - value = None + value = None return htmlklass(self._client, self._classname, None, prop, item, value, self._anonymous) @@ -1206,6 +1192,25 @@ class HTMLProperty(HTMLInputMixin, HTMLPermissions): else: self._formname = name + # If no value is already present for this property, see if one + # is specified in the current form. + form = self._client.form + if not self._value and form.has_key(self._formname): + if isinstance(prop, hyperdb.Multilink): + value = lookupIds(self._db, prop, + handleListCGIValue(form[self._formname]), + fail_ok=1) + elif isinstance(prop, hyperdb.Link): + value = form.getfirst(self._formname).strip() + if value: + value = lookupIds(self._db, prop, [value], + fail_ok=1)[0] + else: + value = None + else: + value = form.getfirst(self._formname).strip() or None + self._value = value + HTMLInputMixin.__init__(self) def __repr__(self):