def render_person(self, person): fields = [] fields.append(person.full_name) if person.latest_status: # The result of utils.get_person_status_text() may be a Django's # proxy object generated by gettext_lazy(). Use str() to convert it # into a str object. # # TODO(ichikawa) Use ugettext_lazy() instead of gettext_lazy() in # const.py so that it can be directly converted into unicode # object here. fields.append( unicode(str(utils.get_person_status_text(person)), 'utf-8')) if person.sex: fields.append( unicode(str(utils.get_person_sex_text(person)), 'utf-8')) if person.age: fields.append(person.age) if person.home_city or person.home_state: fields.append( _('From: %(home_location)s') % { 'home_location': ' '.join( filter(None, [person.home_city, person.home_state])) }) return ' / '.join(fields)
def render_person(self, person): fields = [] fields.append(person.full_name) if person.latest_status: # The result of utils.get_person_status_text() may be a Django's # proxy object generated by gettext_lazy(). Use str() to convert it # into a str object. # # TODO(ichikawa) Use ugettext_lazy() instead of gettext_lazy() in # const.py so that it can be directly converted into unicode # object here. fields.append( unicode(str(utils.get_person_status_text(person)), 'utf-8')) if person.sex: fields.append( unicode(str(utils.get_person_sex_text(person)), 'utf-8')) if person.age: fields.append(person.age) if person.home_city or person.home_state: fields.append( _('From: %(home_location)s') % {'home_location': ' '.join(filter(None, [person.home_city, person.home_state]))}) return ' / '.join(fields)