Module src.jsonid.export_helpers

Helpers for the export functions.

Functions

def get_utc_timestamp_now()
Expand source code
def get_utc_timestamp_now():
    """Get a formatted UTC timestamp for 'now' that can be used when
    a timestamp is needed.
    """
    return datetime.datetime.now(timezone.utc).strftime(UTC_TIME_FORMAT)

Get a formatted UTC timestamp for 'now' that can be used when a timestamp is needed.

def new_prettify(c)
Expand source code
def new_prettify(c):
    """Remove excess newlines from DOM output.

    via: https://stackoverflow.com/a/14493981
    """
    reparsed = parseString(c)
    return "\n".join(
        [
            line
            for line in reparsed.toprettyxml(indent=" " * 2).split("\n")
            if line.strip()
        ]
    )

Remove excess newlines from DOM output.

via: https://stackoverflow.com/a/14493981