swiftly/cli/trans.py
def cli_trans(context, x_trans_id):
    """
    Translates any information that can be determined from the
    x_trans_id and sends that to the context.io_manager's stdout.

    See :py:mod:`swiftly.cli.trans` for context usage information.

    See :py:class:`CLITrans` for more information.
    """
    with context.io_manager.with_stdout() as fp:
        trans_time = get_trans_id_time(x_trans_id)
        trans_info = x_trans_id[34:]
        msg = 'X-Trans-Id:      ' + x_trans_id + '\n'
        if not trans_time:
            msg += 'Time Stamp:      None, old style id with no time ' \
                'embedded\nUTC Time:        None, old style id with no time ' \
                'embedded\n'
        else:
            msg += 'Time Stamp:      %s\nUTC Time:        %s\n' % (
                trans_time,
                time.strftime(
                    '%a %Y-%m-%d %H:%M:%S UTC', time.gmtime(trans_time)))
        msg += 'Additional Info: ' + trans_info + '\n'
        fp.write(msg)
        fp.flush()
def cli_trans(context, x_trans_id):
    """
    Translates any information that can be determined from the
    x_trans_id and sends that to the context.io_manager's stdout.

    See :py:mod:`swiftly.cli.trans` for context usage information.

    See :py:class:`CLITrans` for more information.
    """
    with context.io_manager.with_stdout() as fp:
        trans_time = get_trans_id_time(x_trans_id)
        trans_info = x_trans_id[34:]
        msg = 'X-Trans-Id:      ' + x_trans_id + '\n'
        if not trans_time:
            msg += 'Time Stamp:      None, old style id with no time ' \
                'embedded\nUTC Time:        None, old style id with no time ' \
                'embedded\n'
        else:
            msg += 'Time Stamp:      %s\nUTC Time:        %s\n' % (
                trans_time,
                time.strftime(
                    '%a %Y-%m-%d %H:%M:%S UTC', time.gmtime(trans_time)))
        msg += 'Additional Info: ' + trans_info + '\n'
        fp.write(msg)
        fp.flush()
Translates any information that can be determined from the
    x_trans_id and sends that to the context.io_manager's stdout.

    See :py:mod:`swiftly.cli.trans` for context usage information.

    See :py:class:`CLITrans` for more information.