Changeset 6952 for main/waeup.sirp/trunk/src/waeup/sirp/hostels
- Timestamp:
- 26 Oct 2011, 03:54:42 (13 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp/hostels
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/hostels/container.py
r6951 r6952 21 21 from waeup.sirp.hostels.interfaces import IHostelsContainer 22 22 from waeup.sirp.utils.helpers import attrs_to_fields 23 from waeup.sirp.utils.logger import Logger 23 24 24 class HostelsContainer(grok.Container ):25 class HostelsContainer(grok.Container, Logger): 25 26 """This is a container for all kind of hostels. 26 27 """ … … 38 39 raise NotImplementedError() 39 40 40 HostelsContainer = attrs_to_fields(HostelsContainer) 41 def addHostel(self, hostel): 42 """Add a hostel. 43 """ 44 if not IHostel.providedBy(hostel): 45 raise TypeError( 46 'HostelsContainers contain only IHostel instances') 47 self[hostel.hostel_id] = hostel 48 return 49 50 logger_name = 'waeup.sirp.${sitename}.hostels' 51 logger_filename = 'hostels.log' 52 53 def logger_info(self, ob_class, target, comment=None): 54 """Get the logger's info method. 55 """ 56 user = get_current_principal() 57 if user is None: 58 user = 'system' 59 else: 60 user = user.id 61 self.logger.info('%s - %s - %s - %s' % ( 62 user, ob_class, target, comment)) 63 return -
main/waeup.sirp/trunk/src/waeup/sirp/hostels/hostel.py
r6951 r6952 35 35 return 36 36 37 def loggerInfo(self, ob_class, comment=None): 38 target = self.__name__ 39 return grok.getSite()['hostels'].logger_info(ob_class,target,comment) 40 37 41 Hostel = attrs_to_fields(Hostel) -
main/waeup.sirp/trunk/src/waeup/sirp/hostels/interfaces.py
r6951 r6952 14 14 15 15 """ 16 17 def loggerInfo(ob_class, comment): 18 """Adds an INFO message to the log file 19 """ 20 21 hostel_id = schema.TextLine( 22 title = u'Student ID', 23 required = False, 24 )
Note: See TracChangeset for help on using the changeset viewer.