Changeset 602 for WAeUP_SRP/trunk


Ignore:
Timestamp:
1 Oct 2006, 06:22:11 (18 years ago)
Author:
Henrik Bettermann
Message:

exportLocalRoles fixed by Uli

File:
1 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/trunk/Academics.py

    r598 r602  
    5151        logger = logging.getLogger('%s_import' % name)
    5252        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())
    5454        export = []
    5555        export.append('"code","users"')
     
    6363        odict = {}
    6464        for f in self.portal_catalog({'meta_type': portal_type}):
    65             odict[f.getId] = f.getObject() 
     65            odict[f.getId] = f.getObject()
    6666        for role in imp_roles:
    6767            obj_id = role['code']
     
    177177                    certificates.getContent().edit(mapping=dict)
    178178                d.getContent().edit(mapping=dep)
    179                    
     179
    180180        return self.REQUEST.RESPONSE.redirect("%s" % self.REQUEST.get('URL1'))
    181181    ###)
     
    406406            except:
    407407                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'])
    409409            cc.getContent().edit(mapping=cert_course)
    410410            review_state = cc.get('review_state')
     
    798798        export = []
    799799        export.append('"code","users"')
    800         pm = self.portal_membership
    801800        #import pdb;pdb.set_trace()
    802801        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]
    805807            logger.info('exporting %s %s ' % (obj.id, lr))
    806808            export.append('"%s","%s"' % (obj.getId(),lr))
    807809        open("%s/import/%s-%s.csv" % (i_home,name,current),"w+").write('\n'.join(export))
    808        
    809810###)
    810        
     811
    811812    security.declareProtected(ModifyPortalContent,"exportFacultiesToCSV")###(
    812813    def exportFacultiesToCSV(self):
Note: See TracChangeset for help on using the changeset viewer.