Permanent variable: How am I supposed to transfer the name of the ventor to Flask between my diapers?



  • Good afternoon, there's a very sensitive question. I have a dialogue base that has a ventor. The question is, how am I supposed to transfer the name of the ventor between my weirdos?

    <input name="vendor" value="{{ vendor }}" hidden> 
    

    Count it at every request

    request.args.get('vendor') 
    

    and move further along the chain at the gauge as a hidden field that can take a lot of code. The second sentence is to use the docks. to describe the function

    cookie=request.cookies.get('vendor')
    retrun resp.set_cookie('vendor', 'vendor.cookie.ru') 
    if cookie is not None 
      retrun resp.set_cookie('vendor', 'vendor.cookie.ru')
    else:
      return redirect("set_cookie")
    

    Or put it in a pathetic change, it could turn the logic to the system and into a siege. The question is, as soon as possible, and then the least will be the problem.



  • After a little reflection, I thought I'd stick to the cuisine method. In the paperwork,

    vendor=get_vendor()
        if vendor is None: return redirect('set_cookie')
    

    And there's two of them.

    @app.route("/set_cookie", methods=['GET'])
    def set_cookie():
        vendor=request.args.get('vendor')
        if vendor is None : return redirect('chose_vendor')
        redirect_to_index = redirect('/')
        response = current_app.make_response(redirect_to_index)
        response.set_cookie('vendor', value='author24.ru')
        return response
    

    def get_vendor():
    cookie = request.cookies.get('vendor')
    if cookie is not None:
    return cookie
    else:
    return None

    I suspect that I may be haunted for having brought a business variable into a cuisine, but I'm sure I'm going to have to bat it in a session and stick it to g.user, but there's a meth of Agile's work that's all over the place.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2