Ignore:
Timestamp:
27 Apr 2011, 07:43:49 (14 years ago)
Author:
Henrik Bettermann
Message:

Implement title_prefix vocabulary. Remove redundant getName method and replace by the longtitle property.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/utils/helpers.py

    r5876 r5988  
    118118            pass
    119119    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 getName
    128         >>> 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 rendered
    135     uppercase.
    136        
    137     """
    138     prefix = context.title_prefix
    139     prefix = prefix[0].upper() + prefix[1:]
    140     return '%s of %s' % (prefix, context.title)
    141120
    142121class FactoryBase(grok.GlobalUtility):
Note: See TracChangeset for help on using the changeset viewer.