Exemplo n.º 1
0
def m_to_string(v):
    if isempty(v):
        return escape_html(BLANK)
    elif isinstance(v, unicode):
        return escape_html(v)
    elif isinstance(v, str):
        return escape_html(v.decode('utf8', 'replace'))
    else:
        return escape_html(SEPARATOR.join(v))
Exemplo n.º 2
0
def to_string(value):
    if isempty(value):
        return u''
    elif isinstance(value, str):
        return value.decode('utf8')
    elif isinstance(value, unicode):
        return value
    elif isinstance(value, (float, int, long)):
        return unicode(value)
    else:
        return to_string(value[0])