Changeset 2632 for WAeUP_SRP


Ignore:
Timestamp:
12 Nov 2007, 17:23:46 (17 years ago)
Author:
joachim
Message:

add student_levels, fix for #397,cleanup removeUnusedDocIds

Location:
WAeUP_SRP
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/base/WAeUPTables.py

    r2627 r2632  
    9090###)
    9191
    92     def record2dict(self,fields,record):
     92    def record2dict(self,fields,record): ###(
    9393        d = {}
    9494        for key in fields:
     
    109109                d[key] = ''
    110110        return d
     111
     112###)
    111113
    112114    def addRecord(self, **data): ###(
     
    602604    #               "course_admitted",
    603605    #               )
     606    ###)
     607
    604608    def __init__(self,name=None):
    605609        if name ==  None:
    606610            name = self.name
    607611        WAeUPTable.__init__(self, name)
    608 
    609 
    610612
    611613    security.declareProtected(ModifyPortalContent,"new_importCSV")###(
     
    722724                    logger.info("invalid mode: %s" % mode)
    723725        logger.info("%(mode)sed %(imported)d records, invalid written to %(not_imported_fn)s" % d)
    724 ###)
     726    ###)
    725727
    726728InitializeClass(ApplicantsCatalog)
  • WAeUP_SRP/base/WAeUPTool.py

    r2580 r2632  
    304304        repository = getToolByName(self, 'portal_repository')
    305305        pxtool = getToolByName(self, 'portal_proxies')
     306        logger.info('start')
    306307        pxtool_infos = pxtool.getRevisionsUsed()
     308        logger.info('found  %d used revisions ' % (len(pxtool_infos)))
    307309
    308310        nb_revs = 0
     
    310312        unused_docids_d = {} # all docids that are unused
    311313        ids_unused_revs_docids = [] # ids for revs of unused docids
    312         ids_unused_revs = [] # ids for unused revs
     314        unused_ids = [] # ids for unused revs
    313315        total = 0
    314316        idlist = repository.objectIds()
     317        to_delete = 0
     318        found = False
    315319        for id in idlist:
    316320            docid, rev = repository._splitId(id)
     
    319323                continue
    320324            nb_revs += 1
    321             docids_d[docid] = None
    322325            if not pxtool_infos.has_key(docid):
    323                 unused_docids_d[docid] = None
    324                 ids_unused_revs_docids.append(id)
    325                 ids_unused_revs.append(id)
     326                found = True
     327                to_delete += 1
     328                unused_ids.append(id)
    326329            elif not pxtool_infos[docid].has_key(rev):
    327                 ids_unused_revs.append(id)
    328             if len(ids_unused_revs) >= max:
    329                 repository.manage_delObjects(ids_unused_revs)
     330                found = True
     331                to_delete += 1
     332                unused_ids.append(id)
     333            if found and not to_delete % max:
     334                found = False
    330335                #import pdb;pdb.set_trace()
     336                repository.manage_delObjects(unused_ids)
    331337                transaction.commit()
    332                 total += max
    333                 logger.info('removed %d total %d unused docids ' % (max,total))
    334         anz = len(ids_unused_revs)
    335         if anz > 0:
    336             repository.manage_delObjects(ids_unused_revs)
    337             transaction.commit()
    338             total += anz
    339             logger.info('finished removing %d unused docids ' % (total))
     338                logger.info('removed %d total %d unused docids ' % (max,to_delete))
     339        else:
     340            if unused_ids:
     341                repository.manage_delObjects(unused_ids)
     342                transaction.commit()
     343        logger.info('finished removing %d unused docids ' % (to_delete))
    340344
    341345
  • WAeUP_SRP/base/Widgets.py

    r2604 r2632  
    276276        if len(v) == 1:
    277277            v = value = '0%c' % v
     278        elif len(v) == 9:
     279            v = value[2:4]
    278280        elif not value:
    279281            v = value = self.getSessionId()[0]
    280282        #import pdb;pdb.set_trace()
    281283        sessions = self._getSessions()
    282         if not sessions.has_key(value):
     284        if not sessions.has_key(v):
    283285            datastructure.setError(widget_id, "'%s' not a valid session key" % v)
    284286            return 0
  • WAeUP_SRP/base/skins/waeup_student/study_course_view.pt

    r2490 r2632  
    3131      <tr>
    3232        <td width="220px">Current Study Level:</td>
    33         <td><span tal:content="python:context.portal_vocabularies.levels.get(info['doc'].current_level)" /></td>
     33        <td><span tal:content="python:context.portal_vocabularies.student_levels.get(info['doc'].current_level)" /></td>
    3434      </tr>
    3535      <tr>
  • WAeUP_SRP/uniben/profiles/default/layouts/student_study_course.xml

    r2474 r2632  
    5959  <property name="hidden_layout_modes"/>
    6060  <property name="hidden_readonly_layout_modes"/>
    61   <property name="vocabulary">levels</property>
     61  <property name="vocabulary">student_levels</property>
    6262 </widget>
    6363 <widget name="current_mode" meta_type="Select Widget">
  • WAeUP_SRP/uniben/profiles/default/vocabularies.xml

    r2457 r2632  
    66 <object name="acco_hall_reserved_rooms" meta_type="CPS Method Vocabulary"/>
    77 <object name="levels" meta_type="CPS Vocabulary"/>
     8 <object name="student_levels" meta_type="CPS Method Vocabulary"/>
    89 <object name="csv_names" meta_type="CPS Method Vocabulary"/>
    910 <object name="entry_modes" meta_type="CPS Vocabulary"/>
Note: See TracChangeset for help on using the changeset viewer.