Changeset 6578 for main/waeup.sirp/trunk/src/waeup/sirp/applicants
- Timestamp:
- 6 Aug 2011, 11:11:41 (13 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp/applicants
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/applicants/root.py
r6500 r6578 27 27 from hurry.query.interfaces import IQuery 28 28 from zope.component import getUtility 29 from waeup.sirp.interfaces import IWAeUPSIRPPluggable , ISiteLoggers29 from waeup.sirp.interfaces import IWAeUPSIRPPluggable 30 30 from waeup.sirp.applicants.interfaces import IApplicantsRoot 31 31 from waeup.sirp.utils.helpers import get_current_principal 32 from waeup.sirp.utils.logger import Logger 32 33 33 class ApplicantsRoot(grok.Container ):34 class ApplicantsRoot(grok.Container, Logger): 34 35 """The root of applicants-related components. It contains only 35 36 containers for applicants. … … 39 40 local_roles = ['waeup.ApplicationsOfficer'] 40 41 41 @property 42 def logger(self): 43 """Get a logger for applicants. 44 """ 45 loggers = getUtility(ISiteLoggers).getLoggers() 46 if 'waeup.sirp.%s.applicants' not in loggers.keys(): 47 loggers.register('waeup.sirp.%s.applicants') 48 return loggers.getLogger('waeup.sirp.%s.applicants') 42 logger_name = 'waeup.sirp.${sitename}.applicants' 43 logger_filename = 'applicants.log' 49 44 50 45 def logger_info(self, target, ob_class, comment=None): -
main/waeup.sirp/trunk/src/waeup/sirp/applicants/tests/test_root.py
r6443 r6578 28 28 import unittest 29 29 from StringIO import StringIO 30 from zope.app.testing.functional import FunctionalTestCase 31 from zope.component.hooks import setSite, clearSite 30 from zope.component.hooks import setSite 32 31 from zope.interface.verify import verifyClass, verifyObject 33 from zope.site import LocalSiteManager34 32 from waeup.sirp.app import University 35 33 from waeup.sirp.applicants import ( … … 40 38 ApplicantsRoot, ApplicantsPlugin, 41 39 ) 42 from waeup.sirp.testing import FunctionalLayer 40 from waeup.sirp.testing import ( 41 FunctionalLayer, FunctionalTestCase, get_all_loggers, remove_new_loggers, 42 remove_logger) 43 43 44 44 … … 54 54 def setUp(self): 55 55 super(ApplicantsRootTestCase, self).setUp() 56 56 remove_logger('waeup.sirp.app.applicants') 57 self.old_loggers = get_all_loggers() 57 58 # Setup a sample site for each test 59 60 # Prepopulate the ZODB... 58 61 app = University() 59 self.dc_root = tempfile.mkdtemp()60 app['datacenter'].setStoragePath(self.dc_root)61 62 # Prepopulate the ZODB...63 62 self.getRootFolder()['app'] = app 64 63 self.app = self.getRootFolder()['app'] 65 64 setSite(self.app) 65 66 self.dc_root = tempfile.mkdtemp() 67 app['datacenter'].setStoragePath(self.dc_root) 68 66 69 return 67 70 68 71 def tearDown(self): 69 72 super(ApplicantsRootTestCase, self).tearDown() 73 remove_new_loggers(self.old_loggers) 70 74 shutil.rmtree(self.dc_root) 71 75 return
Note: See TracChangeset for help on using the changeset viewer.