def time(Req): Dict = {"use_f2a": False} cache = caching() if Req.user.is_authenticated(): Dict["logged"] = True if Req.session.has_key("deal_comission"): Dict["deal_comission"] = Req.session["deal_comission_show"] else: ComisObj = UserCustomSettings.objects.get(user_id=Req.user.id, setting__title="deal_comission") DealComission = format_numbers4(Decimal(ComisObj.value) * Decimal("100")) Req.session["deal_comission_show"] = DealComission Req.session["deal_comission"] = format_numbers4(Decimal(ComisObj.value)) Dict["deal_comission"] = DealComission if Req.session.has_key("use_f2a"): Dict["use_f2a"] = Req.session["use_f2a"] else: Dict["use_f2a"] = False else: Dict["deal_comission"] = "0.10" if Req.session.session_key is not None: cache.set("chat_" + Req.session.session_key, Req.user.username, 60000) Dict["usd_uah_rate"] = get_memory_var("usd_uah_rate") Dict["time"] = datetime.now().strftime("%d.%m.%y %H:%M:%S") Dict["sessionid"] = Req.session.session_key return json_true(Req, Dict)
def time(Req): Dict = {"use_f2a": False} cache = caching() if Req.user.is_authenticated(): Dict["logged"] = True if Req.session.has_key("deal_comission"): Dict["deal_comission"] = Req.session["deal_comission_show"] else: ComisObj = UserCustomSettings.objects.get(user_id=Req.user.id, setting__title="deal_comission") DealComission = format_numbers4(Decimal(ComisObj.value) * Decimal("100")) Req.session["deal_comission_show"] = DealComission Req.session["deal_comission"] = format_numbers4(Decimal(ComisObj.value)) Dict["deal_comission"] = DealComission if Req.session.has_key("use_f2a"): Dict["use_f2a"] = Req.session["use_f2a"] else: Dict["use_f2a"] = False else: Dict["deal_comission"] = "0.10" if Req.session.session_key is not None: cache.set("chat_" + Req.session.session_key, Req.user.username, 60000) Dict["usd_uah_rate"] = get_memory_var("usd_uah_rate") Dict["time"] = (datetime.now() - datetime(1970,1,1)).total_seconds() # datetime.now().strftime("%d.%m.%y %H:%M:%S") Dict["sessionid"] = Req.session.session_key return json_true(Req, Dict)
def stock(Req, Title="btc_uah"): if Title is None: Title = Req.session.get('stock_path', None) if Title is None: Title = "btc_uah" Req.session['stock_path'] = Title t = loader.get_template("index.html") Dict = setup_trades_pairs(Title) # Dict = setup_common_orders(Req, Title, Dict ) Dict["current_stock"] = Title Dict["title"] = settings.secondary_main Dict["trade_pair"] = Title Dict["help"] = True Dict["usd_uah_rate"] = get_memory_var("usd_uah_rate") Req.session['stock_path'] = Title return http_tmpl_context(Req, t, Dict)