changeset 2093:be05c7f6d216

Fix Reference element. The 'select' widget used by Reference now uses the 'choice_specs' property instead of 'valid_values' member and 'labels' property.
author Cheer Xiao <xiaqqaix@gmail.com>
date Thu, 25 Apr 2013 18:54:31 +0800
parents f8570c669184
children ce4cce38fe51
files MoinMoin/forms.py
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/forms.py	Thu Apr 25 18:53:30 2013 +0800
+++ b/MoinMoin/forms.py	Thu Apr 25 18:54:31 2013 +0800
@@ -244,7 +244,7 @@
         return cls
 
     @classmethod
-    def _get_choices(cls):
+    def _get_choice_specs(cls):
         revs = flaskg.storage.search(cls._query, **cls._query_args)
         choices = [(rev.meta[ITEMID], rev.meta[NAME]) for rev in revs]
         if cls.optional:
@@ -256,9 +256,9 @@
         # NOTE There is a slight chance of two instances of the same Reference
         # subclass having different set of choices when the storage changes
         # between their initialization.
-        choices = self._get_choices()
-        self.properties['labels'] = dict(choices)
-        self.valid_values = [id_ for id_, name in choices]
+        choice_specs = self._get_choice_specs()
+        self.properties['choice_specs'] = choice_specs
+        self.valid_values = [id_ for id_, name in choice_specs]
 
 
 class BackReference(ReadonlyItemLinkList):