Changeset 807 for WAeUP_SRP/trunk/Widgets.py
- Timestamp:
- 9 Nov 2006, 12:03:52 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/trunk/Widgets.py
r803 r807 329 329 v = datamodel[self.fields[0]] 330 330 #import pdb;pdb.set_trace() 331 clear_doc = self.getStudentInfo()['clear_doc']332 vd = getattr(clear_doc,self.fields[0],None)333 if not vd:334 vd = {} 331 #clear_doc = self.getStudentInfo()['clear_doc'] 332 #vd = getattr(clear_doc,self.fields[0],None) 333 ## if not vd: 334 ## vd = [] 335 335 widget_id = self.getWidgetId() 336 datastructure[widget_id] = v d336 datastructure[widget_id] = v 337 337 datastructure[widget_id+'_s'] = '' 338 338 datastructure[widget_id+'_g'] = '' … … 341 341 def validate(self, datastructure, **kw): ###( 342 342 """Validate datastructure and update datamodel.""" 343 import pdb;pdb.set_trace()343 #import pdb;pdb.set_trace() 344 344 widget_id = self.getWidgetId() 345 345 v = datastructure[widget_id] … … 347 347 s = datastructure[widget_id+'_s'].strip() 348 348 g = datastructure[widget_id+'_g'].strip() 349 if not type(v) is type({}): 350 pass 351 elif not s and g: 352 err = "no subject grad for subject %s " % s 353 elif v.has_key(s): 354 err = "grad for subject %s already given" % s 355 elif s and g: 356 v[s] = g 349 while 1: 350 if not s and g: 351 err = "no subject grad for subject %s " % s 352 break 353 i = 0 354 done = False 355 for sv,gv in v: 356 if sv == s: 357 done = True 358 if not g: 359 v.pop(i) 360 break 361 v[i] = (s,g) 362 break 363 i += 1 364 if done: 365 break 366 if s and g: 367 v.append((s,g)) 368 break 357 369 if err: 358 370 datastructure.setError(widget_id, err) … … 379 391 widget_id = self.getWidgetId() 380 392 v = datamodel[self.fields[0]] 381 datastructure[widget_id] = [{'subject': f, 382 'grade': v[f]} for f in v.keys()] 393 datastructure[widget_id] = v 383 394 datastructure[widget_id+'_s'] = '' 384 395 datastructure[widget_id+'_g'] = ''
Note: See TracChangeset for help on using the changeset viewer.