Changeset 350


Ignore:
Timestamp:
19 Jul 2006, 09:33:54 (18 years ago)
Author:
joachim
Message:

make site accessible for SectionReaders?

Location:
WAeUP_SRP/trunk
Files:
3 edited
1 moved

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/trunk/exportimport.py

    r282 r350  
    3838NAME = 'waeup'
    3939
    40 # The exportWAeUP and importWAeUP methods are called by the specific
    41 # im- / export steps defined in the corresponding XML files in the
    42 # WAeUP/profiles/default/ directory.
    43 
    44 ##def installFaculties( academics): ###(
    45 ##    """install Universityspecific Faculies with Departments"""
    46 ##    faculties = [ ###(
    47 ##                  {'id': 'agriculture', ###(
    48 ##                      'Title': 'Agriculture',
    49 ##                      'departments': [
    50 ####                                     { 'id': 'dep1', ###(
    51 ####                                       'Title': 'One',
    52 ####                                     },
    53 ##                                     ],
    54 ##                      },###)
    55 ##                  ###)
    56 ##                  {'id': 'arts', ###(
    57 ##                      'Title': 'Arts',
    58 ##                      'departments': [
    59 ####                                     { 'id': 'dep1', ###(
    60 ####                                       'Title': 'One',
    61 ####                                     },
    62 ##                                     ],
    63 ##                      },###)
    64 ##                  ###)
    65 ##                  {'id': 'BasicMedicalSciences', ###(
    66 ##                      'Title': 'Basic Medical Sciences',
    67 ##                      'departments': [
    68 ####                                     { 'id': 'dep1', ###(
    69 ####                                       'Title': 'One',
    70 ####                                     },
    71 ##                                     ],
    72 ##                      },###)
    73 ##                  ###)
    74 ##                  {'id': 'science', ###(
    75 ##                  'Title': 'Science',
    76 ##                  'departments': [
    77 ##                                 { 'id': 'bio', ###(
    78 ##                                   'Title': 'Biochemistry',
    79 ##                                 },
    80 ##                                 { 'id': 'bot',
    81 ##                                   'Title': 'Botany',
    82 ##                                 },
    83 ##                                 { 'id': 'che',
    84 ##                                   'Title': 'Chemistry',
    85 ##                                 },
    86 ##                                 { 'id': 'com',
    87 ##                                   'Title': 'Computer Science',
    88 ##                                 },
    89 ##                                 { 'id': 'geo',
    90 ##                                   'Title': 'Geologie',
    91 ##                                 },
    92 ##                                 { 'id': 'mat',
    93 ##                                   'Title': 'Mathematics',
    94 ##                                 },
    95 ##                                 { 'id': 'mic',
    96 ##                                   'Title': 'Microbiology',
    97 ##                                 },
    98 ##                                 { 'id': 'opt',
    99 ##                                   'Title': 'Optometry',
    100 ##                                 },
    101 ##                                 { 'id': 'phy',
    102 ##                                   'Title': 'Physics',
    103 ##                                 },
    104 ##                                 { 'id': 'zoo',
    105 ##                                   'Title': 'Zoology',
    106 ##                                 },
    107 ##                                 ],
    108 ##                  },###)
    109 ##                 ]###)
    110 ##                 
    111 ##                ###)
    112 ##
    113 ##    for faculty in faculties:
    114 ##        fid = faculty['id']
    115 ##        f = getattr(academics,fid,None)
    116 ##        if f is None:
    117 ##            #self.log('Creating Faculty %(id)s = %(Title)s' % faculty)
    118 ##            academics.invokeFactory('Faculty', fid)
    119 ##            f = getattr(academics,fid)
    120 ##            f.getContent().edit(mapping=faculty)
    121 ##        for department in faculty['departments']:
    122 ##            #self.log('Checking Department %(id)s = %(Title)s' % department)
    123 ##            did = department['id']
    124 ##            d = getattr(f,did,None)
    125 ##            if d is None:
    126 ##                #self.log('Creating Department %(id)s = %(Title)s' % department)
    127 ##                f.invokeFactory('Department', did)
    128 ##                d = getattr(f,did)
    129 ##                d.getContent().edit(mapping=department)
    130 #####)
    131 ##
    132 ##def loadFacultiesFromCSV(academics,site,context): ###(
    133 ##    """install Universityspecific Faculies from CSV values"""
    134 ##    #return
    135 ##    logger = context.getLogger('loadfaculties')
    136 ##    logger.info('Start loading Faculties')
    137 ##    try:
    138 ##        faculties = csv.DictReader(open("%s/import/faculty.csv" % i_home,"rb"))
    139 ##    except:
    140 ##        return
    141 ##    l = site.portal_catalog({'meta_type': "Faculty"})
    142 ##    facs = {}
    143 ##    for f in l:
    144 ##        facs[f.id] = f.getObject()
    145 ##    for faculty in faculties:
    146 ##        logger.info('processing %(Session)s %(FacultyCode)s %(Description)s %(CollegeCode)s %(FacultyKey)s %(Status)s %(degree_grade)s %(Bankcode)s' % faculty)
    147 ##        fid = faculty['FacultyCode']
    148 ##        f = facs.get(fid,None)
    149 ##        if f is None:
    150 ##            #self.log('Creating Faculty %(id)s = %(Title)s' % faculty)
    151 ##            logger.info('Creating Faculty with ID %(FacultyCode)s %(Description)s' % faculty)
    152 ##            academics.invokeFactory('Faculty', fid)
    153 ##            f = getattr(academics,fid)
    154 ##        d = {'Title': faculty['Description']}
    155 ##        f.getContent().edit(mapping=d)
    156 #####)
    157 ##
    158 ##def loadDepartmentsFromCSV(academics,site,context): ###(
    159 ##    """install Universityspecific Faculies from CSV values"""
    160 ##    #return
    161 ##    logger = context.getLogger('loaddepartments')
    162 ##    try:
    163 ##        deps = csv.DictReader(open("%s/import/departments.csv" % i_home,"rb"))
    164 ##    except:
    165 ##        return
    166 ##    l = site.portal_catalog({'meta_type': "Faculty"})
    167 ##    facs = {}
    168 ##    for f in l:
    169 ##        facs[f.id] = f.getObject()
    170 ##    for dep in deps:
    171 ##        logger.info('Processing %(Session)s %(DeptCode)s %(Description)s %(FacultyCode)s' % dep)
    172 ##        fid = dep['FacultyCode']
    173 ##        f = facs.get(fid,None)
    174 ##        if f is None:
    175 ##            logger.info( "No Faculty with ID: %s" % fid)
    176 ##        else:
    177 ##            did = dep.get('DeptCode')
    178 ##            d = getattr(f,did,None)
    179 ##            if d is None or d.portal_type == "Faculty":
    180 ##                #self.log('Creating Department %(DeptCode)s = %(Description)s' % dep)
    181 ##                logger.info('Creating Department %(DeptCode)s = %(Description)s' % dep)
    182 ##                f.invokeFactory('Department', did)
    183 ##                d = getattr(f,did)
    184 ##            dict = {'Title': dep['Description']}
    185 ##            d.getContent().edit(mapping=dict)
    186 #####)
    187 ##
    188 ##def loadCoursesFromCSV(academics,site,context): ###(
    189 ##    """install Universityspecific Courses from CSV values"""
    190 ##    #return
    191 ##    logger = context.getLogger('loadcourses')
    192 ##    try:
    193 ##        courses = csv.DictReader(open("%s/import/courses.csv" % i_home,"rb"))
    194 ##    except:
    195 ##        return
    196 ##    l = site.portal_catalog({'meta_type': "Faculty"})
    197 ##    facs = {}
    198 ##    for f in l:
    199 ##        facs[f.id] = f.getObject()
    200 ##    dl = site.portal_catalog({'meta_type': "Department"})
    201 ##    deps = {}
    202 ##    for d in dl:
    203 ##        deps[d.id] = d.getObject()
    204 ##    cl = site.portal_catalog({'meta_type': "Course"})
    205 ##    course_list = [ c.id for c in cl]
    206 ##    for course in courses:
    207 ##        logger.info('Processing %(CourseCode)s %(Description)s %(Credits)s %(Dept)s %(Semester)s %(Session)s %(PassMark)s %(CourseKey)s %(Category)s %(AdmStatus)s %(FORMERCODE)s' % course)
    208 ##        if course.get("FORMERCODE").endswith('BITS'):
    209 ##            continue
    210 ##        depid = course.get('Dept').upper()
    211 ##        if depid in deps.keys():
    212 ##            dept= deps.get(depid)
    213 ####        elif depid in facs.keys():
    214 ####            dept= facs.get(depid)
    215 ##        else:
    216 ##            logger.info("Dep %(Dept)s for Course %(CourseCode)s not found" % course)
    217 ##            continue
    218 ##        course_id = ''.join(re.split('\W+',course.get('CourseCode')))
    219 ##        if len(course_id) == 3:
    220 ##            course_id = "%s000" % course_id
    221 ##        elif len(course_id) != 6:
    222 ##            logger.info("invalid course_code %(CourseCode)s" % course)
    223 ##            #print course_id,course.get('CourseCode'),course.get('Description')
    224 ##            continue
    225 ####        if course_id in course_list:
    226 ####            continue
    227 ##        c = getattr(dept,course_id,None)
    228 ##        if c is None:
    229 ##            #self.log('Creating Department %(DeptCode)s = %(Description)s' % dep)
    230 ##            logger.info('Creating Course %(CourseCode)s  %(Description)s in Department %(Dept)s' % course)
    231 ##            dept.invokeFactory('Course', course_id)
    232 ##            c = getattr(dept,course_id)
    233 ##        dict = {'Title': course['Description']}
    234 ##        dict['code'] = course_id
    235 ##        dict['org_code'] = course.get('CourseCode')
    236 ##        dict['credits'] = course.get('Credits')
    237 ##        dict['semester'] = course.get('Semester')
    238 ##        dict['session'] = course.get('Session')
    239 ##        dict['category'] = course.get('Category')
    240 ##        dict['passmark'] = course.get('PassMark')
    241 ##        c.getContent().edit(mapping=dict)
    242 #####)
    243 ##
    244 ##def loadCertificatesFromCSV(site,context): ###(
    245 ##    """install Universityspecific Certificates from CSV values"""
    246 ##    #return
    247 ##    logger = context.getLogger('loadcertificates')
    248 ##    try:
    249 ##        certificates = csv.DictReader(open("%s/import/certificates.csv" % i_home,"rb"))
    250 ##    except:
    251 ##        return
    252 ##    f_ids = [f.id for f in site.portal_catalog({'meta_type': "Faculty"})]
    253 ##    #d_ids = [d.id for d in site.portal_catalog({'meta_type': "Department"})]
    254 ##    dl = site.portal_catalog({'meta_type': "Department"})
    255 ##    deps = {}
    256 ##    for d in dl:
    257 ##        deps[d.id] = d.getObject()
    258 ##    for certificate in certificates:
    259 ##        logger.info('Processing %(CertCode)s %(Description)s %(Faculty)s %(MaxPass)s %(MaxLoad)s %(session)s %(PromotionCredits)s %(Probationcredits)s %(StartLevel)s %(endLevel)s %(Nyears)s %(Ncore)s %(MaxElect)s %(MPREFIX)s %(Dept)s %(Admstatus)s %(category)s' % certificate)
    260 ##        depid = certificate.get('Dept')
    261 ##        facid = certificate.get('Faculty')
    262 ##        if facid not in f_ids:
    263 ##            logger.info('Faculty %(Faculty)s for %(CertCode)s %(Description)s not found' % certificate)
    264 ##            continue
    265 ##        if not deps.has_key(depid):
    266 ##            logger.info('Department %(Dept)s for %(CertCode)s %(Description)s not found' % certificate)
    267 ##            continue
    268 ##        certificate_id = "%(category)s_%(Admstatus)s_%(Dept)s" % certificate
    269 ##        dep = deps[depid]
    270 ##        c = getattr(dep,certificate_id,None)
    271 ##        if c is None:
    272 ##            #self.log('Creating Department %(DeptCode)s = %(Description)s' % dep)
    273 ##            logger.info('Creating certificate %(CertCode)s  %(Description)s in Department %(Dept)s' % certificate)
    274 ##            dep.invokeFactory('Certificate', certificate_id)
    275 ##            c = getattr(dep,certificate_id)
    276 ##        dict = {'Title': certificate['Description']}
    277 ##        code = certificate.get('CertCode')
    278 ##        code = code.replace('.','')
    279 ##        code = code.replace('(','')
    280 ##        code = code.replace(')','')
    281 ##        code = code.replace('/','')
    282 ##        code = code.replace(' ','')
    283 ##        code = code.replace('_','')
    284 ##        dict['code'] = code
    285 ##        dict['faculty'] = certificate.get('Faculty')
    286 ##        dict['department'] = certificate.get('Dept')
    287 ##        dict['max_pass'] = certificate.get('MaxPass')
    288 ##        dict['max_load'] = certificate.get('MaxLoad')
    289 ##        dict['admin_status'] = certificate.get('Admstatus')
    290 ##        dict['category'] = certificate.get('category')
    291 ##        dict['m_prefix'] = certificate.get('MPREFIX')
    292 ##        dict['nr_years'] = int(certificate.get('Nyears'))
    293 ##        nc = certificate.get('Ncore','1')
    294 ##        try:
    295 ##            dict['n_core'] = int(nc)
    296 ##        except:
    297 ##            dict['n_core'] = 1
    298 ##        dict['start_level'] = certificate.get('StartLevel')
    299 ##        dict['end_level'] = certificate.get('endLevel')
    300 ##        dict['promotion_credits'] = certificate.get('PromotionCredits')
    301 ##        dict['probation_credits'] = certificate.get('ProbationCredits')
    302 ##        c.getContent().edit(mapping=dict)
    303 #####)
    304 ##
    305 ##def oldloadCertificatesFromCSV(certfolder,site,context): ###(
    306 ##    """install Universityspecific Certificates from CSV values"""
    307 ##    logger = context.getLogger('loadcertificates')
    308 ##    certificates = csv.DictReader(open("%s/import/certificates.csv" % i_home,"rb"))
    309 ##    f_ids = [f.id for f in site.portal_catalog({'meta_type': "Faculty"})]
    310 ##    d_ids = [d.id for d in site.portal_catalog({'meta_type': "Department"})]
    311 ##    for certificate in certificates:
    312 ##        depid = certificate.get('Dept')
    313 ##        facid = certificate.get('Faculty')
    314 ##        if facid not in f_ids:
    315 ##            logger.info('Faculty %(Faculty)s for %(CertCode)s %(Description)s not found' % certificate)
    316 ##            continue
    317 ##        if depid not in d_ids:
    318 ##            logger.info('Department %(Dept)s for %(CertCode)s %(Description)s not found' % certificate)
    319 ##            continue
    320 ##        certificate_id = "%(category)s_%(Admstatus)s_%(Dept)s" % certificate
    321 ##        c = getattr(certfolder,certificate_id,None)
    322 ##        if c is None:
    323 ##            #self.log('Creating Department %(DeptCode)s = %(Description)s' % dep)
    324 ##            logger.info('Creating certificate %(CertCode)s  %(Description)s in Department %(Dept)s' % certificate)
    325 ##            certfolder.invokeFactory('Certificate', certificate_id)
    326 ##            c = getattr(certfolder,certificate_id)
    327 ##        dict = {'Title': certificate['Description']}
    328 ##        code = certificate.get('CertCode')
    329 ##        code = code.replace('.','')
    330 ##        code = code.replace('(','')
    331 ##        code = code.replace(')','')
    332 ##        code = code.replace('/','')
    333 ##        code = code.replace(' ','')
    334 ##        code = code.replace('_','')
    335 ##        dict['code'] = code
    336 ##        dict['faculty'] = certificate.get('Faculty')
    337 ##        dict['department'] = certificate.get('Dept')
    338 ##        dict['max_pass'] = certificate.get('MaxPass')
    339 ##        dict['max_load'] = certificate.get('MaxLoad')
    340 ##        dict['admin_status'] = certificate.get('Admstatus')
    341 ##        dict['category'] = certificate.get('category')
    342 ##        dict['m_prefix'] = certificate.get('MPREFIX')
    343 ##        dict['nr_years'] = int(certificate.get('Nyears'))
    344 ##        nc = certificate.get('Ncore','1')
    345 ##        try:
    346 ##            dict['n_core'] = int(nc)
    347 ##        except:
    348 ##            dict['n_core'] = 1
    349 ##        dict['start_level'] = certificate.get('StartLevel')
    350 ##        dict['end_level'] = certificate.get('endLevel')
    351 ##        dict['promotion_credits'] = certificate.get('PromotionCredits')
    352 ##        dict['probation_credits'] = certificate.get('ProbationCredits')
    353 ##        c.getContent().edit(mapping=dict)
    354 #####)
    355 ##
    356 ##def loadCertificateCoursesFromCSV(site,context): ###(
    357 ##    """install Certificate Courses from CSV values"""
    358 ##    #return
    359 ##    logger = context.getLogger('loadcertificatecourses')
    360 ##    try:
    361 ##        cert_courses = csv.DictReader(open("%s/import/course_level_courses.csv" % i_home,"rb"))
    362 ##    except:
    363 ##        return
    364 ##    d_ids = [d.id for d in site.portal_catalog({'meta_type': "Department"})]
    365 ##    for cert_course in cert_courses:
    366 ##        logger.info('Processing %(CosCode)s %(CertCode)s %(CoreKey)s %(Session)s %(Level)s %(Core)s %(Elective)s %(Mandatory)s %(AdmStatus)s %(Dept)s %(Semester)s' % cert_course)
    367 ##        depid = cert_course.get('Dept')
    368 ##        code = cert_course.get('CertCode')
    369 ##        code = code.replace('.','')
    370 ##        code = code.replace('(','')
    371 ##        code = code.replace(')','')
    372 ##        code = code.replace('/','')
    373 ##        code = code.replace(' ','')
    374 ##        code = code.replace('_','')
    375 ##        if cert_course.get('Session') != '2002/2003':
    376 ##            continue
    377 ##        certificate = site.portal_catalog({'meta_type': "Certificate",
    378 ##                                           'SearchableText': code})
    379 ##        if not certificate:
    380 ##            print code
    381 ##            logger.info('CertCode %(CertCode)s for %(CosCode)s not found' % cert_course)
    382 ##            continue
    383 ##        certificate = certificate[-1].getObject()
    384 ##        certificate_code = certificate.getId()
    385 ##        if depid not in d_ids:
    386 ##            logger.info('Department %(Dept)s for %(CertCode)s not found' % cert_course)
    387 ##            continue
    388 ##        course_code = cert_course.get('CosCode')
    389 ##        level = cert_course.get('Level')
    390 ##        l = getattr(certificate,level,None)
    391 ##        if l is None:
    392 ##            #self.log('Creating Department %(DeptCode)s = %(Description)s' % dep)
    393 ##            logger.info('Creating Level %(Level)s in certificate %(CertCode)s' % cert_course)
    394 ##            certificate.invokeFactory('StudyLevel', level)
    395 ##            l = getattr(certificate, level)
    396 ##            l.invokeFactory('Semester','first')
    397 ##            l.invokeFactory('Semester','second')
    398 ##        first_s = getattr(l,'first')
    399 ##        second_s = getattr(l,'second')
    400 ##        if cert_course.get('Semester') == '1':
    401 ##            semester = first_s
    402 ##        else:
    403 ##            semester = second_s
    404 ##        if hasattr(semester,course_code):
    405 ##            logger.info('Duplicate %(CosCode)s in Level %(Level)s' % cert_course)
    406 ##            continue
    407 ##           
    408 ##        semester.invokeFactory('CertificateCourse',course_code)
    409 ##        cc = getattr(semester,course_code)
    410 ##        dict = {}
    411 ##        dict['code'] = cert_course.get('CosCode')
    412 ##        dict['certificate_code'] = code
    413 ##        dict['certificate_code_org'] = cert_course.get('CertCode')
    414 ##        dict['department'] = cert_course.get('Dept')
    415 ##        dict['admin_status'] = cert_course.get('Admstatus')
    416 ##        dict['session'] = cert_course.get('Session')
    417 ##        if cert_course.get('Core') != '':
    418 ##            dict['core_or_elective'] = True
    419 ##        else:
    420 ##            dict['core_or_elective'] = False
    421 ##        dict['level'] = cert_course.get('Level')
    422 ##        cc.getContent().edit(mapping=dict)
    423 #####)
    424 ##
    425 ##def old_loadCertificateCoursesFromCSV(certfolder,site,context): ###(
    426 ##    """install Certificate Courses from CSV values"""
    427 ##    return
    428 ##    logger = context.getLogger('loadcertificatecourses')
    429 ##    cert_courses = csv.DictReader(open("%s/import/course_level_courses.csv" % i_home,"rb"))
    430 ##    d_ids = [d.id for d in site.portal_catalog({'meta_type': "Department"})]
    431 ##    for cert_course in cert_courses:
    432 ##        depid = cert_course.get('Dept')
    433 ##        code = cert_course.get('CertCode')
    434 ##        code = code.replace('.','')
    435 ##        code = code.replace('(','')
    436 ##        code = code.replace(')','')
    437 ##        code = code.replace('/','')
    438 ##        code = code.replace(' ','')
    439 ##        code = code.replace('_','')
    440 ##        if cert_course.get('Session') != '2002/2003':
    441 ##            continue
    442 ##        certificate = site.portal_catalog({'meta_type': "Certificate",
    443 ##                                           'SearchableText': code})
    444 ##        if not certificate:
    445 ##            print code
    446 ##            logger.info('CertCode %(CertCode)s for %(CosCode)s not found' % cert_course)
    447 ##            continue
    448 ##        certificate = certificate[-1].getObject()
    449 ##        certificate_code = certificate.getId()
    450 ##        if depid not in d_ids:
    451 ##            logger.info('Department %(Dept)s for %(CertCode)s not found' % cert_course)
    452 ##            continue
    453 ##        course_code = cert_course.get('CosCode')
    454 ##        level = cert_course.get('Level')
    455 ##        l = getattr(certificate,level,None)
    456 ##        if l is None:
    457 ##            #self.log('Creating Department %(DeptCode)s = %(Description)s' % dep)
    458 ##            logger.info('Creating Level %(Level)s in certificate %(CertCode)s' % cert_course)
    459 ##            certificate.invokeFactory('StudyLevel', level)
    460 ##            l = getattr(certificate, level)
    461 ##            l.invokeFactory('Semester','first')
    462 ##            l.invokeFactory('Semester','second')
    463 ##        first_s = getattr(l,'first')
    464 ##        second_s = getattr(l,'second')
    465 ##        if cert_course.get('Semester') == '1':
    466 ##            semester = first_s
    467 ##        else:
    468 ##            semester = second_s
    469 ##        if hasattr(semester,course_code):
    470 ##            logger.info('Duplicate %(CosCode)s in Level %(Level)s' % cert_course)
    471 ##            continue
    472 ##           
    473 ##        semester.invokeFactory('CertificateCourse',course_code)
    474 ##        cc = getattr(semester,course_code)
    475 ##        dict = {}
    476 ##        dict['code'] = cert_course.get('CosCode')
    477 ##        dict['certificate_code'] = code
    478 ##        dict['certificate_code_org'] = cert_course.get('CertCode')
    479 ##        dict['department'] = cert_course.get('Dept')
    480 ##        dict['admin_status'] = cert_course.get('Admstatus')
    481 ##        dict['session'] = cert_course.get('Session')
    482 ##        if cert_course.get('Core') != '':
    483 ##            dict['core_or_elective'] = True
    484 ##        else:
    485 ##            dict['core_or_elective'] = False
    486 ##        dict['level'] = cert_course.get('Level')
    487 ##        cc.getContent().edit(mapping=dict)
    488 #####)
    489 ##
    490 ##def setupStructure(site,context): ###(
    491 ##    portal = getattr(site,'uniportal',None)
    492 ##    if portal is None:
    493 ##        site.invokeFactory('University','uniportal')
    494 ##        portal = getattr(site,'uniportal',None)
    495 ##        portal.getContent().edit(mapping={'Title':SRPP_TITLE})
    496 ##    students =  getattr(portal,'students',None)
    497 ##    if students is None:
    498 ##        portal.invokeFactory('StudentsFolder','students')
    499 ##        students = getattr(portal,'students').getContent()
    500 ##        students.edit(mapping={'Title':'Students'})
    501 ##    academics = getattr(portal,'academics',None)
    502 ##    if academics is None:
    503 ##        portal.invokeFactory('AcademicsFolder','academics')
    504 ##        academics = getattr(portal,'academics')
    505 ##        academics.getContent().edit(mapping={'Title':'Academics'})
    506 ##    loadFacultiesFromCSV(academics,site,context)
    507 ##    loadDepartmentsFromCSV(academics,site,context)
    508 ##    loadCoursesFromCSV(academics,site,context)
    509 ####    certificates = getattr(academics,'certificates',None)
    510 ####    if certificates is None:
    511 ####        academics.invokeFactory('SCFolder','certificates')
    512 ####        certificates = getattr(academics,'certificates')
    513 ####        certificates.getContent().edit(mapping={'Title':'Certificates'})
    514 ##    loadCertificatesFromCSV(site,context)
    515 ##    loadCertificateCoursesFromCSV(site,context)
    516 ##    if not hasattr(portal,'accommodation'):
    517 ##        portal.invokeFactory('AccoFolder','accommodation')
    518 ##        accommodation = getattr(portal,'accommodation').getContent()
    519 ##        accommodation.edit(mapping={'Title':'Accommodation'})
    520 #####)
    521 
    522 
    52340def exportWAeUP(context):
    52441    """Export our WAeUP tool configuration
     
    53653    """
    53754    site = context.getSite()
     55    pm = site.portal_membership
     56    if hasattr(site,'campus'):
     57        pm.setLocalGroupRoles(site.campus,['role:Authenticated',],'SectionReader')
    53858    #setupStructure(site,context)
    53959    #import pdb; pdb.set_trace()
  • WAeUP_SRP/trunk/skins/waeup_custom/getCPSCandidateLocalRoles.py

    r334 r350  
    1717from Products.CMFCore.utils import getToolByName
    1818mtool = getToolByName(context, 'portal_membership')
    19 return mtool.getCPSCandidateLocalRoles(context)
    20 return ['SectionManager']
     19#return mtool.getCPSCandidateLocalRoles(context)
     20return ['SectionReader','SectionManager']
  • WAeUP_SRP/trunk/skins/waeup_custom/logged_in.pt

    r334 r350  
    3838                   dum_home mtool/createMemberArea"
    3939                   >
    40           <tal:block
    41               condition="python:0"
    42               tal:define="dummy python: context.process_waeup_login(member=member,sc_pin=request.get('sc_pin'))" />
     40          <span tal:condition="nothing"
     41              tal:define="dummy python: context.process_waeup_login(member=member,sc_pin=request.get('sc_pin',None))" />
    4342          <tal:block condition="first_time">
    4443            <div tal:define="now here/ZopeTime;
  • WAeUP_SRP/trunk/skins/waeup_default/process_waeup_login.py

    r347 r350  
    77request = context.REQUEST
    88response=request.response
     9return
     10##
     11##if request.form.get('submit') == 'Login':
     12##    #waeup = context.portal_catalog(id = 'demouni')[0]
     13##    #waeup = context.portal_catalog(portal_type = 'University')[0]
     14##    if 1 or "Manager" in member.getRoles():
     15##        return
     16###return
     17##member_id = str(member)
     18##ma = getattr(context,member_id)
     19##jkw = {'admission_sc_pin': sc_pin}
     20##jamb = getattr(ma,'JAMB')
     21##jamb.getContent().edit(mapping=jkw)
     22###pdid = 'personal%s' % member_id
     23##pdid = 'PERSONAL'
     24##ma.invokeFactory('StudentPersonal', pdid)
     25##pd = getattr(ma,pdid)
     26##pkw = {}
     27##jc = jamb.getContent()
     28##pkw['sex'] = getattr(jc,'sex')
     29##pkw['firstname'] = getattr(jc,'firstname')
     30##pkw['middlename'] = getattr(jc,'middlename')
     31##pkw['lastname'] = getattr(jc,'lastname')
     32##pkw['aggregate'] = getattr(jc,'aggregate')
     33##pkw['faculty'] = getattr(jc,'faculty')
     34##pkw['course'] = getattr(jc,'course')
     35##pkw['age'] = getattr(jc,'age')
     36##pkw['jamb_results'] = getattr(jc,'exam_results')
     37##pkw['jamb_aggregate'] = getattr(jc,'aggregate')
     38##pkw['jamb_listing_date'] = getattr(jc,'listing_date')
     39##pkw['state'] = getattr(jc,'state')
     40##
     41##pd.getContent().edit(mapping=pkw)
     42##context.notifyCPSDocumentCreation(ob=pd)
     43##
     44##pdid = 'DOCUMENTS'
     45##ma.invokeFactory('StudentDocuments', pdid)
     46##pd = getattr(ma,pdid)
     47##context.notifyCPSDocumentCreation(ob=pd)
     48##
     49##pdid = 'ELIGIBILITY'
     50##ma.invokeFactory('StudentEligibility', pdid)
     51##pd = getattr(ma,pdid)
     52##pd.getContent().edit(mapping=pkw)
     53##context.notifyCPSDocumentCreation(ob=pd)
     54##
     55##return response.redirect("%s" % ma.absolute_url())
     56###return ma.personal_addon(REQUEST=context.REQUEST)
    957
    10 if request.form.get('submit') == 'Login':
    11     #waeup = context.portal_catalog(id = 'demouni')[0]
    12     #waeup = context.portal_catalog(portal_type = 'University')[0]
    13     if 1 or "Manager" in member.getRoles():
    14         return
    15 #return
    16 member_id = str(member)
    17 ma = getattr(context,member_id)
    18 jkw = {'admission_sc_pin': sc_pin}
    19 jamb = getattr(ma,'JAMB')
    20 jamb.getContent().edit(mapping=jkw)
    21 #pdid = 'personal%s' % member_id
    22 pdid = 'PERSONAL'
    23 ma.invokeFactory('StudentPersonal', pdid)
    24 pd = getattr(ma,pdid)
    25 pkw = {}
    26 jc = jamb.getContent()
    27 pkw['sex'] = getattr(jc,'sex')
    28 pkw['firstname'] = getattr(jc,'firstname')
    29 pkw['middlename'] = getattr(jc,'middlename')
    30 pkw['lastname'] = getattr(jc,'lastname')
    31 pkw['aggregate'] = getattr(jc,'aggregate')
    32 pkw['faculty'] = getattr(jc,'faculty')
    33 pkw['course'] = getattr(jc,'course')
    34 pkw['age'] = getattr(jc,'age')
    35 pkw['jamb_results'] = getattr(jc,'exam_results')
    36 pkw['jamb_aggregate'] = getattr(jc,'aggregate')
    37 pkw['jamb_listing_date'] = getattr(jc,'listing_date')
    38 pkw['state'] = getattr(jc,'state')
    39 
    40 pd.getContent().edit(mapping=pkw)
    41 context.notifyCPSDocumentCreation(ob=pd)
    42 
    43 pdid = 'DOCUMENTS'
    44 ma.invokeFactory('StudentDocuments', pdid)
    45 pd = getattr(ma,pdid)
    46 context.notifyCPSDocumentCreation(ob=pd)
    47 
    48 pdid = 'ELIGIBILITY'
    49 ma.invokeFactory('StudentEligibility', pdid)
    50 pd = getattr(ma,pdid)
    51 pd.getContent().edit(mapping=pkw)
    52 context.notifyCPSDocumentCreation(ob=pd)
    53 
    54 return response.redirect("%s" % ma.absolute_url())
    55 #return ma.personal_addon(REQUEST=context.REQUEST)
    56 
Note: See TracChangeset for help on using the changeset viewer.