Changeset 3272
- Timestamp:
- 5 Mar 2008, 21:57:35 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/base/WAeUPTool.py
r3271 r3272 478 478 current = DateTime.DateTime().strftime("%d-%m-%y_%H_%M_%S") 479 479 export_file = "%s/export/member_list_%s.csv" % (i_home,current,) 480 logger.info('%s dumped member list to %s' % (member,export_file))480 logger.info('%s dumped member list to %s' % (member,export_file)) 481 481 fields = l[0].keys() 482 482 headline = ','.join(fields) … … 488 488 csv_writer.writerows(l) 489 489 ###) 490 491 security.declareProtected(ManagePortal, 'listStudents') ###( 492 def listStudents(self): 493 "list all students" 494 mtool = self.portal_membership 495 member = mtool.getAuthenticatedMember() 496 logger = logging.getLogger('WAeUPTool.listStudents') 497 if str(member) not in ('admin','joachim'): 498 logger.info('%s tried to list students' % (member)) 499 return None 500 students = self.portal_directories.students 501 all = students.listEntryIdsAndTitles() 502 l = [] 503 for user_id,name in all: 504 d = {} 505 d['user_id'] = user_id 506 d['name'] = name 507 d['pw'] = getattr(getattr(students,user_id),'password') 508 d['email'] = getattr(getattr(students,user_id),'email') 509 d['groups'] = " ".join(getattr(getattr(students,user_id),'groups')) 510 d['roles'] = " ".join(getattr(getattr(students,user_id),'roles')) 511 l += d, 512 current = DateTime.DateTime().strftime("%d-%m-%y_%H_%M_%S") 513 export_file = "%s/export/student_list_%s.csv" % (i_home,current,) 514 logger.info('%s dumped student list to %s' % (member,export_file)) 515 fields = l[0].keys() 516 headline = ','.join(fields) 517 out = open(export_file,"wb") 518 out.write(headline +'\n') 519 out.close() 520 out = open(export_file,"a") 521 csv_writer = csv.DictWriter(out,fields,) 522 csv_writer.writerows(l) 523 ###) 490 524 491 525 security.declareProtected(ManagePortal, 'removeDeletedDocIds') ###(
Note: See TracChangeset for help on using the changeset viewer.