Changeset 3438 for WAeUP_SRP/base


Ignore:
Timestamp:
16 Apr 2008, 07:04:19 (17 years ago)
Author:
Henrik Bettermann
Message:

change from upper to lower case keys

fillApplicationCategory.py: improve logging

enable export and import of application_category field

remove vocabulary property from layouts

Location:
WAeUP_SRP/base
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/base/Academics.py

    r3379 r3438  
    633633        heading += '"category","study_mode","end_level","m_prefix","max_elect","max_pass",'
    634634        heading += '"n_core","nr_years","original_code","probation_credits",'
    635         heading += '"promotion_credits","start_level","admin_status"'
     635        heading += '"promotion_credits","start_level","admin_status","application_category"'
    636636        dataline = '"%(code)s","%(review_state)s","%(title)s","%(faculty_code)s","%(department_code)s",'
    637637        dataline += '"%(category)s","%(study_mode)s","%(end_level)s","%(m_prefix)s","%(max_elect)s","%(max_pass)s",'
    638638        dataline += '"%(n_core)s","%(nr_years)s","%(original_code)s","%(probation_credits)s",'
    639         dataline += '"%(promotion_credits)s","%(start_level)s","%(admin_status)s"'
     639        dataline += '"%(promotion_credits)s","%(start_level)s","%(admin_status)s","%(application_category)s"'
    640640        export.append(heading)
    641641        #import pdb;pdb.set_trace()
     
    664664                    di['promotion_credits'] = getattr(certificate_d,'promotion_credits',None)
    665665                    di['start_level'] = getattr(certificate_d,'start_level',None)
     666                    di['application_category'] = getattr(certificate_d,'application_category',None)
    666667                    di['code'] = di['code'] or certificate.id
    667668                    di['review_state'] = self.portal_workflow.getInfoFor(certificate,'review_state','no_state')
  • WAeUP_SRP/base/Widgets.py

    r3436 r3438  
    787787        self._dict = d
    788788        self._msgids = m
    789    
     789
    790790    def __getitem__(self, key):
    791791        """Get a label for a key."""
     
    849849    def _getVocabulary(self,datastructure=None):
    850850        if self.REQUEST.traverse_subpath:
    851             screening_type = self.REQUEST.traverse_subpath[0].upper()
    852         else:
    853             screening_type = 'ALL'
    854         if screening_type in ("ALL","CEST","SANDWICH"):
     851            screening_type = self.REQUEST.traverse_subpath[0].lower()
     852        else:
     853            screening_type = 'all'
     854        if screening_type in ("all","cest","sandwich"):
    855855            application_category = screening_type
    856856        else:
     
    866866        l  = []
    867867        for k,d in self._v_certificates_docs.items():
    868             if application_category == "ALL":
     868            if application_category == "all":
    869869                l  += (k,self._v_certificates_docs[k].title,k),
    870870            else:
     
    873873        #import ipdb;ipdb.set_trace()
    874874        return VocabularyOnTheFly(l)
    875                                        
     875
    876876InitializeClass(ApplicationCourseWidget)
    877877
  • WAeUP_SRP/base/skins/waeup_utilities/fillApplicationCategory.py

    r3436 r3438  
    1 ## Script (Python) "ti_507_resolve"
     1## Script (Python) "fillApplicationCategory"
    22##bind container=container
    33##bind context=context
     
    3636logger.info('start')
    3737count = 0
     38not_count = 0
    3839found = 0
    3940commit_after = 1000
     
    4142certificates = context.portal_catalog.search({'meta_type': "Certificate"})
    4243logger.info("found %d certificates" % len(certificates))
    43 cat = {'cos': 'BASIC',
    44        'cos_cest': 'CEST',
    45        'cos_sandwich': 'SANDWICH',
     44cat = {'cos': 'basic',
     45       'cos_cest': 'cest',
     46       'cos_sandwich': 'sandwich',
    4647       }
    4748to_change = {}
     
    5960        logger.info("%s in %s" % (cert.id,','.join(found)))
    6061        count += 1
     62    else:
     63        not_count += 1
     64        logger.info("%s not in vocabularies" % (cert.id,))
    6165for cert,d in to_change.items():
    6266    d['cert_doc'].edit(mapping = d)
    63     logger.info("set application_category of %s to %s" % 
     67    logger.info("set application_category of %s to %s" %
    6468               (cert,d['application_category']))
    65 logger.info("found %d not in vocabularies" % count)
     69logger.info("%d cert codes found, %d not found in vocabularies" % (count,not_count))
Note: See TracChangeset for help on using the changeset viewer.