Ignore:
Timestamp:
16 Dec 2011, 07:32:42 (13 years ago)
Author:
Henrik Bettermann
Message:

Implement fullname constructor as a global utility method which can easily be subject to customization. I think it's better to leave this here rather than selecting the constructor method via the customization object.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/students/student.py

    r7357 r7359  
    2121import os
    2222import grok
     23from zope.component import getUtility
    2324from zope.component.interfaces import IFactory
    2425from zope.interface import implementedBy
     
    2627from zope.securitypolicy.interfaces import IPrincipalRoleManager
    2728from waeup.sirp.interfaces import (
    28     IObjectHistory, IUserAccount, IFileStoreNameChooser, IFileStoreHandler)
     29    IObjectHistory, IUserAccount, IFileStoreNameChooser, IFileStoreHandler,
     30    ISIRPUtils)
    2931from waeup.sirp.image import SIRPImageFile
    3032from waeup.sirp.imagestorage import DefaultFileStoreHandler
     
    6365    @property
    6466    def fullname(self):
    65         # We do not necessarily have the middlename attribute
    6667        middlename = getattr(self, 'middlename', None)
    67         if middlename:
    68             return '%s %s %s' % (self.firstname,
    69                 middlename, self.lastname)
    70         else:
    71             return '%s %s' % (self.firstname, self.lastname)
     68        sirp_utils = getUtility(ISIRPUtils)
     69        return sirp_utils.fullname(self.firstname, self.lastname, middlename)
    7270
    7371    @property
Note: See TracChangeset for help on using the changeset viewer.