Changeset 1025 for WAeUP_SRP/trunk/Widgets.py
- Timestamp:
- 10 Dec 2006, 18:39:15 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/trunk/Widgets.py
r1020 r1025 246 246 247 247 248 ###) 249 250 class StudyCourseWidget(CPSStringWidget): ###( 251 """ StudyCourse Widget""" 252 meta_type = "StudyCourse Widget" 253 254 def validate(self, datastructure, **kw): 255 """Validate datastructure and update datamodel.""" 256 #from Products.zdb import set_trace 257 #set_trace() 258 valid = CPSStringWidget.validate(self, datastructure, **kw) 259 id_pat_str = r"\S" 260 inv_id_pat = compile(r"^%s$" % id_pat_str) 261 if not valid: 262 return 0 263 else: 264 widget_id = self.getWidgetId() 265 value = datastructure[widget_id].upper() 266 err = 0 267 if len(value.split()) > 1: 268 err = 'Invalid Id, Id contains space(s).' 269 elif not self.portal_catalog(portal_type='Certificate',id=value): 270 err = 'No such certificate' 271 if err: 272 datastructure.setError(widget_id, err) 273 else: 274 datamodel = datastructure.getDataModel() 275 datamodel[self.fields[0]] = value 276 return not err 277 278 InitializeClass(StudyCourseWidget) 279 280 widgetRegistry.register(StudyCourseWidget) 248 281 ###) 249 282 … … 471 504 pin = "%(prefix)s%(b)s%(n)s" % vars() 472 505 do = 1 473 s_id = ''506 s_id = str(self.portal_membership.getAuthenticatedMember()) 474 507 if self.reference == "": 475 ref = s tr(self.portal_membership.getAuthenticatedMember())508 ref = s_id 476 509 else: 477 510 ref = datastructure[self.reference]
Note: See TracChangeset for help on using the changeset viewer.