Changeset 5375 for main/waeup.widgets.core/trunk/src
- Timestamp:
- 6 Aug 2010, 08:50:03 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.widgets.core/trunk/src/waeup/widgets/core/dictwidget.py
r5368 r5375 48 48 template = ViewPageTemplateFile('dictwidget.pt') 49 49 50 def __init__(self, context, request, subwidget=None): 50 def __init__(self, context, request, key_subwidget=None, 51 value_subwidget=None): 51 52 super(DictWidget, self).__init__(context, None, request) 52 self.subwidget = subwidget 53 self.key_subwidget = key_subwidget 54 self.value_subwidget = value_subwidget 53 55 54 56 # The subwidgets are cached in this dict if preserve_widgets is True. … … 69 71 if i not in self._widgets: 70 72 key_field = self.context.key_type 71 if self. subwidget is not None:72 key_widget = self. subwidget(key_field, self.request)73 if self.key_subwidget is not None: 74 key_widget = self.key_subwidget(key_field, self.request) 73 75 else: 74 76 key_widget = getMultiAdapter( … … 77 79 78 80 value_field = self.context.value_type 79 if self. subwidget is not None:80 value_widget = self. subwidget(value_field, self.request)81 if self.value_subwidget is not None: 82 value_widget = self.value_subwidget(value_field, self.request) 81 83 else: 82 84 value_widget = getMultiAdapter( … … 224 226 extra = "" 225 227 226 def __init__(self, context, request, subwidget=None): 228 def __init__(self, context, request, key_subwidget=None, 229 value_subwidget=None): 227 230 super(DictDisplayWidget, self).__init__(context, request) 228 self.subwidget = subwidget 231 self.key_subwidget = key_subwidget 232 self.value_subwidget = value_subwidget 229 233 230 234 def __call__(self): … … 266 270 key_field = self.context.key_type 267 271 value_field = self.context.value_type 268 if self.subwidget is not None: 269 key_widget = self.subwidget(key_field, self.request) 270 value_widget = self.subwidget(value_field, self.request) 272 if self.key_subwidget is not None: 273 key_widget = self.key_subwidget(key_field, self.request) 271 274 else: 272 275 key_widget = getMultiAdapter( 273 276 (key_field, self.request), IDisplayWidget) 277 if self.value_subwidget is not None: 278 value_widget = self.value_subwidget(value_field, self.request) 279 else: 274 280 value_widget = getMultiAdapter( 275 281 (value_field, self.request), IDisplayWidget)
Note: See TracChangeset for help on using the changeset viewer.