Changeset 5988 for main/waeup.sirp/trunk/src/waeup/sirp/utils
- Timestamp:
- 27 Apr 2011, 07:43:49 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/utils/helpers.py
r5876 r5988 118 118 pass 119 119 return html_code 120 121 def getName(context):122 """Construct a name out of an object with prefix and title.123 124 The `context` has to provide `title_prefix` and `title`125 attributes.126 127 >>> from waeup.sirp.utils.helpers import getName128 >>> class FakeObject(object):129 ... title_prefix = 'department'130 ... title = 'Strange Things'131 >>> getName(FakeObject())132 'Department of Strange Things'133 134 As we can see in the result the `title_prefix` is rendered135 uppercase.136 137 """138 prefix = context.title_prefix139 prefix = prefix[0].upper() + prefix[1:]140 return '%s of %s' % (prefix, context.title)141 120 142 121 class FactoryBase(grok.GlobalUtility):
Note: See TracChangeset for help on using the changeset viewer.