def rates3(): session.forget(response) curr_out = db(db.currs.abbrev == 'BTC').select().first() if not curr_out: return 'curr_out [BTC] not found' currs_list = ['BTC', 'LTC', 'DASH', 'ERA', 'COMPU'] import rates_lib btc_rates = [] for r in rates_lib.top_line(db, curr_out, currs_list): btc_rates.append(r) curr_out = db(db.currs.abbrev == 'USD').select().first() if not curr_out: return 'curr_out [USD] not found' usd_rates = [] for r in rates_lib.top_line(db, curr_out, currs_list): usd_rates.append(r) curr_out = db(db.currs.abbrev == 'RUB').select().first() if not curr_out: return 'curr_out [RUB] not found' rub_rates = [] for r in rates_lib.top_line(db, curr_out, currs_list): rub_rates.append(r) return dict(btc=btc_rates, usd=usd_rates, rub=rub_rates)
def rates(): session.forget(response) curr_out = db(db.currs.abbrev == 'BTC').select().first() if not curr_out: return 'curr_out [BTC] not found' currs_list = ['BTC', 'LTC', 'ERA', 'COMPU'] import rates_lib tl = CAT() for r in rates_lib.top_line(db, curr_out, currs_list): tl += SPAN( #r[0], IMG(_src=URL('static', 'images/currs/' + r[1] + '.png'), _width=24), #':', r[0], TAG.i(_class='fa fa-btc', _style='color:#ffb761;'), # chartreuse ' ', #_class='small' ) #return DIV(TAG.center(tl)) curr_out = db(db.currs.abbrev == 'USD').select().first() if not curr_out: return 'curr_out [USD] not found' for r in rates_lib.top_line(db, curr_out, currs_list): tl += SPAN( #r[0], IMG(_src=URL('static', 'images/currs/' + r[1] + '.png'), _width=24), #':', r[0], TAG.i(_class='fa fa-usd', _style='color:chartreuse;'), # chartreuse ' ', #_class='small' ) curr_out = db(db.currs.abbrev == 'RUB').select().first() if not curr_out: return 'curr_out [RUB] not found' for r in rates_lib.top_line(db, curr_out, currs_list): tl += SPAN( #r[0], IMG(_src=URL('static', 'images/currs/' + r[1] + '.png'), _width=24), #':', r[0], TAG.i(_class='fa fa-rub', _style='color:#ffacac;'), # chartreuse ' ', #_class='small' ) #return DIV(TAG.center(tl)) return tl
def informer(): session.forget(response) curr_out = db(db.currs.abbrev == 'RUB').select().first() if not curr_out: return 'curr_out [RUB] not found' args = request.args gc = args(0) if not gc: return 'use URL/[partner_cod]/CURR1/CURR2/...?m=[TEXT] or URL/[partner_cod]?m=[TEXT} or URL/[partner_cod]' import rates_lib tl = CAT() for r in rates_lib.top_line(db, curr_out, len(args) > 1 and args[1:] or []): tl += SPAN( IMG(_src=URL('static', 'images/currs/' + r[1] + '.png'), _style='margin-bottom: -10px;', _width=30), r[0], ' ', ) h = CAT( #INPUT(_name='acc'), DIV( DIV( A( tl, BR(), request.vars.m or 'Призы на сотовый', _href='https://' + DOMEN + '/to_phone?gc=%s' % gc, _target='_blank', _style= 'color:#333;display:block;line-height: 30px; font-size:20px; text-decoration: none; padding:8; background-color:#ADD8FF', _onMouseOver= "this.style.color='#000'; this.style.backgroundColor='#CDE8FF'", _onMouseOut= "this.style.color='#333'; this.style.backgroundColor='ADD8FF'", ), _style='', ), _style='', ), ) return h
def rates(): session.forget(response) curr_out = db(db.currs.abbrev == 'RUB').select().first() if not curr_out: return 'curr_out [RUB] not found' import rates_lib tl = CAT() for r in rates_lib.top_line(db, curr_out): tl += SPAN( #r[0], IMG(_src=URL('static', 'images/currs/' + r[1] + '.png'), _width=24), #':', r[0], TAG.i(_class='fa fa-rub', _style='color:chartreuse;'), ' ', #_class='small' ) #return DIV(TAG.center(tl)) return tl