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/applicants/applicant.py

    r7356 r7359  
    1919import grok
    2020from grok import index
     21from zope.component import getUtility
    2122from zope.component.interfaces import IFactory
    2223from zope.component import createObject, getUtility
     
    2930from waeup.sirp.imagestorage import DefaultFileStoreHandler
    3031from waeup.sirp.interfaces import (
    31     IObjectHistory, IFileStoreHandler, IFileStoreNameChooser)
     32    IObjectHistory, IFileStoreHandler, IFileStoreNameChooser, ISIRPUtils)
    3233from waeup.sirp.utils.helpers import attrs_to_fields, get_current_principal
    3334from waeup.sirp.applicants.interfaces import (
     
    7172    @property
    7273    def fullname(self):
    73         # We do not necessarily have the middlename attribute
    7474        middlename = getattr(self, 'middlename', None)
    75         if middlename:
    76             return '%s %s %s' % (self.firstname,
    77                 middlename, self.lastname)
    78         else:
    79             return '%s %s' % (self.firstname, self.lastname)
     75        sirp_utils = getUtility(ISIRPUtils)
     76        return sirp_utils.fullname(self.firstname, self.lastname, middlename)
    8077
    8178    def createStudent(self):
Note: See TracChangeset for help on using the changeset viewer.