Changeset 9087 for main/waeup.kofa/trunk


Ignore:
Timestamp:
7 Aug 2012, 06:17:31 (12 years ago)
Author:
Henrik Bettermann
Message:

Improve logging.

Location:
main/waeup.kofa/trunk/src/waeup/kofa
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/browser/pages.py

    r9074 r9087  
    167167    ob_class = view.__implemented__.__name__.replace('waeup.kofa.','')
    168168    if fields_string:
    169         grok.getSite().logger.info('%s - saved: %s' % (ob_class, fields_string))
     169        grok.getSite().logger.info('%s - %s - saved: %s' % (ob_class, view.context.__name__, fields_string))
    170170    return
    171171
  • main/waeup.kofa/trunk/src/waeup/kofa/university/batching.py

    r9001 r9087  
    123123
    124124        # Log actions...
     125        location_field = self.location_fields[0]
    125126        grok.getSite().logger.info('%s - %s - Record updated: %s'
    126             % (self.name, self.location_fields[0], items_changed))
     127            % (self.name, row[location_field], items_changed))
    127128        return items_changed
    128129
  • main/waeup.kofa/trunk/src/waeup/kofa/university/tests/test_batching.py

    r9038 r9087  
    103103        #self.app['faculties']['fac1']['dep1'].certificates['CERT1'].addCertCourse(
    104104        #    self.course, level=100)
     105       
     106        self.logfile = os.path.join(
     107            self.app['datacenter'].storage, 'logs', 'main.log')
     108        return
    105109        return
    106110
     
    291295        shutil.rmtree(os.path.dirname(fin_file))
    292296        return
     297       
     298    def test_import_update_logging(self):
     299        self.app['faculties']['FAC2'] = Faculty(code='FAC2')
     300        self.app['faculties']['FAC3'] = Faculty(code='FAC3')
     301        self.app['faculties']['FAC4'] = Faculty(code='FAC4')
     302        num, num_warns, fin_file, fail_file = self.proc.doImport(
     303            self.csv_file_faculty_update, FACULTY_HEADER_FIELDS_UPDATE, 'update')
     304        self.assertEqual(num_warns,0)
     305        logcontent = open(self.logfile).read()
     306        # Logging message from updateEntry
     307        self.assertTrue(
     308            'INFO - system - Department Processor - DEP2 - '
     309            'Record updated: local_roles=anne|waeup.local.DepartmentManager, '
     310            'code=DEP2'
     311            in logcontent)
    293312
    294313    def test_upload_import_reupload(self):
     
    403422            'Not all parents do exist yet. Skipping\r\n'
    404423            )
    405         # Anne got a local role in department ABC.
     424        # Anne got a local role in department DEP2.
    406425        dep = self.app['faculties']['FAC1']['DEP2']
    407426        role_map = IPrincipalRoleMap(dep)
     
    488507            'Not all parents do exist yet. Skipping\r\n'
    489508            )
    490         # Anne got a local role in course ABC.
     509        # Anne got a local role in course CRS2.
    491510        dep = self.app['faculties']['FAC1']['DEP1'].courses['CRS2']
    492511        role_map = IPrincipalRoleMap(dep)
     
    574593            'Not all parents do exist yet. Skipping\r\n'
    575594            )
    576         # Anne got a local role in certificate ABC.
     595        # Anne got a local role in certificate CRT2.
    577596        dep = self.app['faculties']['FAC1']['DEP1'].certificates['CRT2']
    578597        role_map = IPrincipalRoleMap(dep)
     
    581600        self.assertEqual(local_role, 'waeup.local.CourseAdviser100')
    582601        shutil.rmtree(os.path.dirname(fin_file))
     602       
     603        logcontent = open(self.logfile).read()
     604        # Logging message from updateEntry
     605        self.assertTrue(
     606            'INFO - system - Certificate Processor - CRT2 - Record updated: '
     607            'local_roles=anne|waeup.local.CourseAdviser100, code=CRT2'
     608            in logcontent)       
     609       
    583610        return
    584611
Note: See TracChangeset for help on using the changeset viewer.