common/uilib.py
changeset 3230 1d25e928c299
parent 3185 bd0126d17e83
parent 3212 07d11bacfefe
child 3369 7b88d12b4ee2
equal deleted inserted replaced
3199:fc63b80ec979 3230:1d25e928c299
    29     :return: the rql query
    29     :return: the rql query
    30     """
    30     """
    31     return 'Any X WHERE X eid %s' % eid
    31     return 'Any X WHERE X eid %s' % eid
    32 
    32 
    33 
    33 
    34 def printable_value(req, attrtype, value, props=None):
    34 def printable_value(req, attrtype, value, props=None, displaytime=True):
    35     """return a displayable value (i.e. unicode string)"""
    35     """return a displayable value (i.e. unicode string)"""
    36     if value is None or attrtype == 'Bytes':
    36     if value is None or attrtype == 'Bytes':
    37         return u''
    37         return u''
    38     if attrtype == 'String':
    38     if attrtype == 'String':
    39         # don't translate empty value if you don't want strange results
    39         # don't translate empty value if you don't want strange results
    44     if attrtype == 'Date':
    44     if attrtype == 'Date':
    45         return ustrftime(value, req.property_value('ui.date-format'))
    45         return ustrftime(value, req.property_value('ui.date-format'))
    46     if attrtype == 'Time':
    46     if attrtype == 'Time':
    47         return ustrftime(value, req.property_value('ui.time-format'))
    47         return ustrftime(value, req.property_value('ui.time-format'))
    48     if attrtype == 'Datetime':
    48     if attrtype == 'Datetime':
    49         return ustrftime(value, req.property_value('ui.datetime-format'))
    49         if displaytime:
       
    50             return ustrftime(value, req.property_value('ui.datetime-format'))
       
    51         return ustrftime(value, req.property_value('ui.date-format'))
    50     if attrtype == 'Boolean':
    52     if attrtype == 'Boolean':
    51         if value:
    53         if value:
    52             return req._('yes')
    54             return req._('yes')
    53         return req._('no')
    55         return req._('no')
    54     if attrtype == 'Float':
    56     if attrtype == 'Float':