common/uilib.py
branch3.5
changeset 3212 07d11bacfefe
parent 3165 0a50ebe53db7
child 3230 1d25e928c299
child 3352 83aabc5e3de3
equal deleted inserted replaced
3210:44fa8d4a25d5 3212:07d11bacfefe
    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':