Restore prettify stake' Fixes broken sprout and abridged details references.

pull/1625/head
Kieran Prasch 2020-01-26 20:05:07 -08:00 committed by Kieran R. Prasch
parent 2df20d1aae
commit 96a6088f11
3 changed files with 21 additions and 5 deletions

View File

@ -486,6 +486,24 @@ def paint_stakes(emitter, stakeholder, paint_inactive: bool = False, staker_addr
emitter.echo(tabulate.tabulate(rows, headers=headers, tablefmt="fancy_grid")) # newline
def prettify_stake(stake, index: int = None) -> str:
start_datetime = stake.start_datetime.local_datetime().strftime("%b %d %H:%M %Z")
expiration_datetime = stake.unlock_datetime.local_datetime().strftime("%b %d %H:%M %Z")
duration = stake.duration
pretty_periods = f'{duration} periods {"." if len(str(duration)) == 2 else ""}'
pretty = f'| {index if index is not None else "-"} ' \
f'| {stake.staker_address[:6]} ' \
f'| {stake.worker_address[:6]} ' \
f'| {stake.index} ' \
f'| {str(stake.value)} ' \
f'| {pretty_periods} ' \
f'| {start_datetime} - {expiration_datetime} ' \
return pretty
def paint_staged_stake_division(emitter,
stakeholder,
original_stake,

View File

@ -891,7 +891,7 @@ class Learner:
except NodeSeemsToBeDown:
self.log.info(f"Verification Failed - "
f"Cannot establish connection to {node}.")
f"Cannot establish connection to {sprout}.")
except sprout.StampNotSigned:
self.log.warn(f'Verification Failed - '

View File

@ -19,7 +19,6 @@ import binascii
import os
from typing import Tuple
from bytestring_splitter import VariableLengthBytestring
from constant_sorrow import constants
from constant_sorrow.constants import FLEET_STATES_MATCH, NO_KNOWN_NODES
from flask import Flask, Response, jsonify
@ -27,8 +26,6 @@ from flask import request
from hendrix.experience import crosstown_traffic
from jinja2 import Template, TemplateError
from twisted.logger import Logger
from umbral.keys import UmbralPublicKey
from umbral.kfrags import KFrag
import nucypher
from nucypher.config.storages import ForgetfulNodeStorage
@ -42,6 +39,8 @@ from nucypher.keystore.threading import ThreadedSession
from nucypher.network import LEARNING_LOOP_VERSION
from nucypher.network.exceptions import NodeSeemsToBeDown
from nucypher.network.protocols import InterfaceInfo
from umbral.keys import UmbralPublicKey
from umbral.kfrags import KFrag
HERE = BASE_DIR = os.path.abspath(os.path.dirname(__file__))
TEMPLATES_DIR = os.path.join(HERE, "templates")
@ -362,7 +361,6 @@ def make_rest_app(
log.info("Bad TreasureMap ID; not storing {}".format(treasure_map_id))
assert False
@rest_app.route('/status/', methods=['GET'])
def status():
if request.args.get('json'):