Changeset 602 for WAeUP_SRP/trunk
- Timestamp:
- 1 Oct 2006, 06:22:11 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/trunk/Academics.py
r598 r602 51 51 logger = logging.getLogger('%s_import' % name) 52 52 current = DateTime.DateTime().strftime("%d-%m-%y_%H_%M_%S") 53 logger.info('Start exporting %(name)s to %(name)s_%(current)s.csv' % vars())53 logger.info('Start importing %(name)s to %(name)s_%(current)s.csv' % vars()) 54 54 export = [] 55 55 export.append('"code","users"') … … 63 63 odict = {} 64 64 for f in self.portal_catalog({'meta_type': portal_type}): 65 odict[f.getId] = f.getObject() 65 odict[f.getId] = f.getObject() 66 66 for role in imp_roles: 67 67 obj_id = role['code'] … … 177 177 certificates.getContent().edit(mapping=dict) 178 178 d.getContent().edit(mapping=dep) 179 179 180 180 return self.REQUEST.RESPONSE.redirect("%s" % self.REQUEST.get('URL1')) 181 181 ###) … … 406 406 except: 407 407 pass 408 cert_course['core_or_elective'] = eval(cert_course['core_or_elective']) 408 cert_course['core_or_elective'] = eval(cert_course['core_or_elective']) 409 409 cc.getContent().edit(mapping=cert_course) 410 410 review_state = cc.get('review_state') … … 798 798 export = [] 799 799 export.append('"code","users"') 800 pm = self.portal_membership801 800 #import pdb;pdb.set_trace() 802 801 for obj in objects: 803 lr = pm.getMergedLocalRoles(obj) 804 #lr = pm.getCPSCandidateLocalRoles(obj) 802 lr = {} 803 for (username, roles) in obj.get_local_roles(): 804 lr[ 'user:' + username ] = [x for x in roles] 805 for (groupname, roles) in obj.get_local_group_roles(): 806 lr[ 'group:' + group ] = [x for x in roles] 805 807 logger.info('exporting %s %s ' % (obj.id, lr)) 806 808 export.append('"%s","%s"' % (obj.getId(),lr)) 807 809 open("%s/import/%s-%s.csv" % (i_home,name,current),"w+").write('\n'.join(export)) 808 809 810 ###) 810 811 811 812 security.declareProtected(ModifyPortalContent,"exportFacultiesToCSV")###( 812 813 def exportFacultiesToCSV(self):
Note: See TracChangeset for help on using the changeset viewer.