Changeset 388 for WAeUP_SRP/trunk/Widgets.py
- Timestamp:
- 17 Aug 2006, 20:26:31 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/trunk/Widgets.py
r381 r388 143 143 ###) 144 144 145 class WAeUPIdWidget(CPSStringWidget): ###( 146 """ WAeUPId Widget""" 147 meta_type = "WAeUPId Widget" 148 149 def validate(self, datastructure, **kw): 150 """Validate datastructure and update datamodel.""" 151 152 valid = CPSStringWidget.validate(self, datastructure, **kw) 153 if not valid: 154 return 0 155 else: 156 widget_id = self.getWidgetId() 157 value = datastructure[widget_id].upper() 158 err = 0 159 if hasattr(self.aq_parent,value): 160 err = 'An object with the Id %s already exists in this context' % (value) 161 if err: 162 datastructure.setError(widget_id, err) 163 else: 164 datamodel = datastructure.getDataModel() 165 datamodel[self.fields[0]] = value 166 167 return not err 168 169 InitializeClass(WAeUPIdWidget) 170 171 widgetRegistry.register(WAeUPIdWidget) 172 173 174 ###) 175 145 176 class StudentIdWidget(CPSStringWidget): ###( 146 177 """ StudentId Widget"""
Note: See TracChangeset for help on using the changeset viewer.