def get_wallet_info(wallet):
    """
    Add some info to a wallet object
    """
    info = cache.get('walletinfo%d' % wallet.id)
    if info == None:
        try:
            conn = connection.get_connection(wallet)
            info = conn.getinfo()
        except socket.error, v:  # pragma: no cover
            if v[0] == errno.ECONNREFUSED:
                info = False
                flash(u"%s: Connection refused" % wallet.label, 'error')
            elif v[0] == errno.ECONNRESET:
                info = False
                flash(u"%s: Connection reset" % wallet.label, 'error')
            elif v[0] == errno.EHOSTUNREACH:
                info = False
                flash(u"%s: Host unreachable" % wallet.label, 'error')
            elif v[0] == -2:  # WTF
                info = False
                flash(u"%s: Unknown error" % wallet.label, 'error')
            #elif type(v) == socket.cachetime:
            #    info = False
            #    flash(u"%s: cachetime" % wallet.label, 'error')
            else:
                print v[0]
                print dir(v)
                print type(v)
                flash(u"Unhandled exception!", 'error')
        except ValueError:  # pragma: no cover
            info = False
            flash(u"%s: Auth error (?)" % wallet.label, 'error')
        except BadStatusLine:  # pragma: no cover
            # I think this was too much load on the node box
            info = False
            flash(u"%s: Bad status line." % wallet.label, 'error')
        except SSLError:  # pragma: no cover
            info = False
            flash(u"%s: SSL error." % wallet.label, 'error')
        except TransportException, e:  # pragma: no cover
            if e.code == 403:
                info = False
                flash(u"%s: " % e.msg, 'error')
            else:
                flash(u"Unhandled transport exception!", 'error')
        except Exception, e:  # pragma: no cover
            print e
            print dir(e)
            print type(e)
            flash(u"Unhandled exception!", 'error')
    cache.set(wallet.id % 'walletinfo%d', info, timeout=get_cachetime())
    return info
dataset/ETHPy150Open nkuttler/flaskwallet/walletapp/views/wallet.py/get_wallet_info/swapped operands of `%`