Пример #1
0
def htmlify_validation(validation):
    """Process the `message` and `description` fields into
    safe HTML, with URLs turned into links."""

    for msg in validation['messages']:
        msg['message'] = linkify_escape(msg['message'])

        if 'description' in msg:
            # Description may be returned as a single string, or list of
            # strings. Turn it into lists for simplicity on the client side.
            if not isinstance(msg['description'], (list, tuple)):
                msg['description'] = [msg['description']]

            msg['description'] = [
                linkify_escape(text) for text in msg['description']]
Пример #2
0
def htmlify_validation(validation):
    """Process the `message` and `description` fields into
    safe HTML, with URLs turned into links."""

    for msg in validation['messages']:
        msg['message'] = linkify_escape(msg['message'])

        if 'description' in msg:
            # Description may be returned as a single string, or list of
            # strings. Turn it into lists for simplicity on the client side.
            if not isinstance(msg['description'], (list, tuple)):
                msg['description'] = [msg['description']]

            msg['description'] = [
                linkify_escape(text) for text in msg['description']]
Пример #3
0
def htmlify_validation(validation):
    """Process the `message`, `description`, and `signing_help` fields into
    safe HTML, with URLs turned into links."""

    for msg in validation['messages']:
        msg['message'] = linkify_escape(msg['message'])

        for key in 'description', 'signing_help':
            if key in msg:
                # These may be returned as single strings, or lists of
                # strings. Turn them all into lists for simplicity
                # on the client side.
                if not isinstance(msg[key], (list, tuple)):
                    msg[key] = [msg[key]]

                msg[key] = [linkify_escape(text) for text in msg[key]]
Пример #4
0
def htmlify_validation(validation):
    """Process the `message`, `description`, and `signing_help` fields into
    safe HTML, with URLs turned into links."""

    for msg in validation['messages']:
        msg['message'] = linkify_escape(msg['message'])

        for key in 'description', 'signing_help':
            if key in msg:
                # These may be returned as single strings, or lists of
                # strings. Turn them all into lists for simplicity
                # on the client side.
                if not isinstance(msg[key], (list, tuple)):
                    msg[key] = [msg[key]]

                msg[key] = [linkify_escape(text) for text in msg[key]]