~metalune/public-inbox

2 2

[PATCH 1/2] simplytranslate: Fixing SwitchButton with cookies

Details
Message ID
<AM9P191MB1522D1913F6684823D4AC350DFF69@AM9P191MB1522.EURP191.PROD.OUTLOOK.COM>
DKIM signature
pass
Download raw message
Patch: +11 -6
---
 main.py | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/main.py b/main.py
index da1d287..03714e9 100644
--- a/main.py
+++ b/main.py
@@ -64,6 +64,11 @@ async def switchlanguages():
        from_lang = to_lang
        to_lang = tmp_from_lang

    if session.get("from_lang") and sesssion.get('to_lang'):
        tmp_session_from_lang = session['from_lang']
        session['from_lang'] = session['to_lang']
        session['to_lang'] = tmp_session_from_lang

    use_text_fields = request.args.get("typingiscool") == "True"

    """
@@ -133,10 +138,10 @@ async def index():

        to_lang = to_full_name(request.args.get("tl", "en"), engine)

        if session.get('from_language'):
            from_lang = session['from_language']
        if session.get('to_language'):
            to_lang = session['to_language']
        if session.get('from_lang'):
            from_lang = to_full_name(session['from_lang'], engine)
        if session.get('to_lang'):
            to_lang = to_full_name(session['to_lang'], engine)

    elif request.method == "POST":
        form = await request.form
@@ -147,8 +152,8 @@ async def index():

        to_lang = form.get("to_language", "English")

        session['from_language'] = from_lang
        session['to_language'] = to_lang
        session['from_lang'] = to_lang_code(from_lang, engine)
        session['to_lang'] = to_lang_code(to_lang, engine)

    from_l_code = None
    to_l_code = None
-- 
2.25.1
Details
Message ID
<AM9P191MB15226DBC31377A3199DCF868DFF69@AM9P191MB1522.EURP191.PROD.OUTLOOK.COM>
In-Reply-To
<AM9P191MB1522D1913F6684823D4AC350DFF69@AM9P191MB1522.EURP191.PROD.OUTLOOK.COM> (view parent)
DKIM signature
pass
Download raw message
Really sorry, but there is a typo in my code. The first line in the 
changes has `sesssion` instead of `session`.
Details
Message ID
<CDF1HGCXISY4.3NEJOVYZL4IBO@thinkpad>
In-Reply-To
<AM9P191MB15226DBC31377A3199DCF868DFF69@AM9P191MB1522.EURP191.PROD.OUTLOOK.COM> (view parent)
DKIM signature
pass
Download raw message
Thank you for the patch, I fixed the typo as well
Reply to thread Export thread (mbox)