From 2cc69e724684eba5ce69fbdc8ed157b9bc83cc5a Mon Sep 17 00:00:00 2001 From: Doug Le Tough Date: Mon, 30 Oct 2017 11:11:40 +0100 Subject: [PATCH] "Menu escamotble pour tTh" --- .gitignore | 3 + result.log | 1121 ----------------- static/images/menu.png | Bin 0 -> 458 bytes static/scripts/tetalab.js | 9 + static/style/{style.css => style_neutral.css} | 0 static/style/style_tth.css | 411 ++++++ templates/error.html | 2 +- templates/index.html | 3 +- templates/wip.html | 2 +- tetastock.py | 56 +- 10 files changed, 460 insertions(+), 1147 deletions(-) delete mode 100644 result.log create mode 100644 static/images/menu.png rename static/style/{style.css => style_neutral.css} (100%) create mode 100644 static/style/style_tth.css diff --git a/.gitignore b/.gitignore index 2546afb..df0b61c 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,7 @@ *.pyc config.tetalab.py pg_* +*.sql +*.sh +result.log diff --git a/result.log b/result.log deleted file mode 100644 index 71451fd..0000000 --- a/result.log +++ /dev/null @@ -1,1121 +0,0 @@ -This is METAFONT, Version 2.71828 (Web2C 7.5.4) (base=mf 2015.3.24) 25 OCT 2017 09:34 -**templates/result.html templates/result_componants.html -(templates/result.html -! A statement can't begin with `<'. - - < -l.1 < - h3>Résultat: -? -! Extra tokens will be flushed. - - < -l.1 < - h3>Résultat: -? -! Interruption. -l.1 < - h3>Résultat: -? -! Text line contains an invalid character. -l.1

RÃ - ©sultat:

-? -! Text line contains an invalid character. -l.1

Ré - sultat:

-? q -OK, entering batchmode... -! Text line contains an invalid character. -l.6 ...'>{{ row_count }} objet{{ ss }} selectionnà - ©{{ ss }} -A funny symbol that I can't read has just been input. -Continue, and I'll forget that it ever happened. - -! Text line contains an invalid character. -l.6 ...>{{ row_count }} objet{{ ss }} selectionné - {{ ss }} -A funny symbol that I can't read has just been input. -Continue, and I'll forget that it ever happened. - -! A tertiary expression can't begin with `<'. - - 0 - - < -l.8 < - label onclick='javascript:update_componants_by_reference(... -I'm afraid I need some sort of value in order to continue, -so I've tentatively inserted `0'. You may want to -delete this zero and insert something else; -see Chapter 27 of The METAFONTbook for an example. - ->> ' -! Unknown relation will be considered false. - - < -l.8 < - label onclick='javascript:update_componants_by_reference(... -Oh dear. I can't decide if the expression above is positive, -negative, or zero. So this comparison test won't be `true'. - ->> false ->> label.onclick -! Not implemented: (boolean)<(unknown numeric). - - = -l.8 -A funny symbol that I can't read has just been input. -Continue, and I'll forget that it ever happened. - -! Text line contains an invalid character. -l.8 ...ponants_by_reference("{{ order }}");'>Réfà - ©rence -A funny symbol that I can't read has just been input. -Continue, and I'll forget that it ever happened. - -! Text line contains an invalid character. -l.8 ...onants_by_reference("{{ order }}");'>Réfé - rence -A funny symbol that I can't read has just been input. -Continue, and I'll forget that it ever happened. - ->> -R.f.rence+' -! Unknown relation will be considered false. - - < -l.8 ..._by_reference("{{ order }}");'>Référence< - /label> -Oh dear. I can't decide if the expression above is positive, -negative, or zero. So this comparison test won't be `true'. - -! A tertiary expression can't begin with `/'. - - 0 - - / -l.8 ...by_reference("{{ order }}");'>Référence -I'm afraid I need some sort of value in order to continue, -so I've tentatively inserted `0'. You may want to -delete this zero and insert something else; -see Chapter 27 of The METAFONTbook for an example. - ->> 0 ->> label -! Not implemented: (known numeric)/(unknown numeric). - - > -l.8 ...erence("{{ order }}");'>Référence - -I'm afraid I don't know how to apply that operation to that -combination of types. Continue, and I'll return the second -argument (see above) as the result of the operation. - ->> false ->> label -! Not implemented: (boolean)<(unknown numeric). - - > -l.8 ...erence("{{ order }}");'>Référence - -I'm afraid I don't know how to apply that operation to that -combination of types. Continue, and I'll return the second -argument (see above) as the result of the operation. - -! A tertiary expression can't begin with `<'. - - 0 - - < -l.9 < - label onclick='javascript:update_componants_by_designatio... -I'm afraid I need some sort of value in order to continue, -so I've tentatively inserted `0'. You may want to -delete this zero and insert something else; -see Chapter 27 of The METAFONTbook for an example. - ->> label -! Unknown relation will be considered false. - - < -l.9 < - label onclick='javascript:update_componants_by_designatio... -Oh dear. I can't decide if the expression above is positive, -negative, or zero. So this comparison test won't be `true'. - ->> false ->> label.onclick -! Not implemented: (boolean)<(unknown numeric). - - = -l.9 -A funny symbol that I can't read has just been input. -Continue, and I'll forget that it ever happened. - ->> -D.signation+' -! Unknown relation will be considered false. - - < -l.9 ...r_left' style='width: 440px;'>Désignation< - /label> -Oh dear. I can't decide if the expression above is positive, -negative, or zero. So this comparison test won't be `true'. - -! A tertiary expression can't begin with `/'. - - 0 - - / -l.9 ..._left' style='width: 440px;'>Désignation -I'm afraid I need some sort of value in order to continue, -so I've tentatively inserted `0'. You may want to -delete this zero and insert something else; -see Chapter 27 of The METAFONTbook for an example. - ->> 0 ->> label -! Not implemented: (known numeric)/(unknown numeric). - - > -l.9 ... style='width: 440px;'>Désignation - -I'm afraid I don't know how to apply that operation to that -combination of types. Continue, and I'll return the second -argument (see above) as the result of the operation. - ->> false ->> label -! Not implemented: (boolean)<(unknown numeric). - - > -l.9 ... style='width: 440px;'>Désignation - -I'm afraid I don't know how to apply that operation to that -combination of types. Continue, and I'll return the second -argument (see above) as the result of the operation. - -! A tertiary expression can't begin with `<'. - - 0 - - < -l.10 < - label onclick='javascript:update_componants_by_quantity(... -I'm afraid I need some sort of value in order to continue, -so I've tentatively inserted `0'. You may want to -delete this zero and insert something else; -see Chapter 27 of The METAFONTbook for an example. - ->> label -! Unknown relation will be considered false. - - < -l.10 < - label onclick='javascript:update_componants_by_quantity(... -Oh dear. I can't decide if the expression above is positive, -negative, or zero. So this comparison test won't be `true'. - ->> false ->> label.onclick -! Not implemented: (boolean)<(unknown numeric). - - = -l.10 -I've just read as much of that statement as I could fathom, -so a semicolon should have been next. It's very puzzling... -but I'll try to get myself back together, by ignoring -everything up to the next `;'. Please insert a semicolon -now in front of anything that you don't want me to delete. -(See Chapter 27 of The METAFONTbook for an example.) - -! Text line contains an invalid character. -l.10 ...order_left' style='width: 100px;'>Quantità - © -A funny symbol that I can't read has just been input. -Continue, and I'll forget that it ever happened. - -! Text line contains an invalid character. -l.10 ...rder_left' style='width: 100px;'>Quantité - -A funny symbol that I can't read has just been input. -Continue, and I'll forget that it ever happened. - ->> -Quantit+' -! Unknown relation will be considered false. - - < -l.10 ...der_left' style='width: 100px;'>Quantité< - /label> -Oh dear. I can't decide if the expression above is positive, -negative, or zero. So this comparison test won't be `true'. - -! A tertiary expression can't begin with `/'. - - 0 - - / -l.10 ...er_left' style='width: 100px;'>Quantité -I'm afraid I need some sort of value in order to continue, -so I've tentatively inserted `0'. You may want to -delete this zero and insert something else; -see Chapter 27 of The METAFONTbook for an example. - ->> 0 ->> label -! Not implemented: (known numeric)/(unknown numeric). - - > -l.10 ...t' style='width: 100px;'>Quantité - -I'm afraid I don't know how to apply that operation to that -combination of types. Continue, and I'll return the second -argument (see above) as the result of the operation. - ->> false ->> label -! Not implemented: (boolean)<(unknown numeric). - - > -l.10 ...t' style='width: 100px;'>Quantité - -I'm afraid I don't know how to apply that operation to that -combination of types. Continue, and I'll return the second -argument (see above) as the result of the operation. - -! A tertiary expression can't begin with `<'. - - 0 - - < -l.11 < - label onclick='javascript:update_componants_by_place("{{... -I'm afraid I need some sort of value in order to continue, -so I've tentatively inserted `0'. You may want to -delete this zero and insert something else; -see Chapter 27 of The METAFONTbook for an example. - ->> label -! Unknown relation will be considered false. - - < -l.11 < - label onclick='javascript:update_componants_by_place("{{... -Oh dear. I can't decide if the expression above is positive, -negative, or zero. So this comparison test won't be `true'. - ->> false ->> label.onclick -! Not implemented: (boolean)<(unknown numeric). - - = -l.11 - -I'm afraid I don't know how to apply that operation to that -combination of types. Continue, and I'll return the second -argument (see above) as the result of the operation. - ->> false ->> label -! Not implemented: (boolean)<(unknown numeric). - - > -l.11 ... style='width: 160px;'>Emplacement - -I'm afraid I don't know how to apply that operation to that -combination of types. Continue, and I'll return the second -argument (see above) as the result of the operation. - -! A tertiary expression can't begin with `<'. - - 0 - - < -l.12 < - label style='width: 106px; cursor: default;'>Action -I'm afraid I need some sort of value in order to continue, -so I've tentatively inserted `0'. You may want to -delete this zero and insert something else; -see Chapter 27 of The METAFONTbook for an example. - ->> label -! Unknown relation will be considered false. - - < -l.12 < - label style='width: 106px; cursor: default;'>Action -Oh dear. I can't decide if the expression above is positive, -negative, or zero. So this comparison test won't be `true'. - ->> false ->> label.style -! Not implemented: (boolean)<(unknown numeric). - - = -l.12 -I'm afraid I don't know how to apply that operation to that -combination of types. Continue, and I'll return the second -argument (see above) as the result of the operation. - -! Extra tokens will be flushed. - - : -l.12 -I've just read as much of that statement as I could fathom, -so a semicolon should have been next. It's very puzzling... -but I'll try to get myself back together, by ignoring -everything up to the next `;'. Please insert a semicolon -now in front of anything that you don't want me to delete. -(See Chapter 27 of The METAFONTbook for an example.) - ->> cursor -! Isolated expression. - - : -l.12 ... -I couldn't find an `=' or `:=' after the -expression that is shown above this error message, -so I guess I'll just ignore it and carry on. - -! Extra tokens will be flushed. - - : -l.12 ... -I've just read as much of that statement as I could fathom, -so a semicolon should have been next. It's very puzzling... -but I'll try to get myself back together, by ignoring -everything up to the next `;'. Please insert a semicolon -now in front of anything that you don't want me to delete. -(See Chapter 27 of The METAFONTbook for an example.) - ->> -Action+' -! Unknown relation will be considered false. - - < -l.12 ...e='width: 106px; cursor: default;'>Action< - /label> -Oh dear. I can't decide if the expression above is positive, -negative, or zero. So this comparison test won't be `true'. - -! A tertiary expression can't begin with `/'. - - 0 - - / -l.12 ...='width: 106px; cursor: default;'>Action -I'm afraid I need some sort of value in order to continue, -so I've tentatively inserted `0'. You may want to -delete this zero and insert something else; -see Chapter 27 of The METAFONTbook for an example. - ->> 0 ->> label -! Not implemented: (known numeric)/(unknown numeric). - - > -l.12 ...h: 106px; cursor: default;'>Action - -I'm afraid I don't know how to apply that operation to that -combination of types. Continue, and I'll return the second -argument (see above) as the result of the operation. - ->> false ->> label -! Not implemented: (boolean)<(unknown numeric). - - > -l.12 ...h: 106px; cursor: default;'>Action - -I'm afraid I don't know how to apply that operation to that -combination of types. Continue, and I'll return the second -argument (see above) as the result of the operation. - -! A tertiary expression can't begin with `<'. - - 0 - - < -l.13 < - /div> -I'm afraid I need some sort of value in order to continue, -so I've tentatively inserted `0'. You may want to -delete this zero and insert something else; -see Chapter 27 of The METAFONTbook for an example. - ->> label -! Unknown relation will be considered false. - - < -l.13 < - /div> -Oh dear. I can't decide if the expression above is positive, -negative, or zero. So this comparison test won't be `true'. - -! A tertiary expression can't begin with `/'. - - 0 - - / -l.13 -I'm afraid I need some sort of value in order to continue, -so I've tentatively inserted `0'. You may want to -delete this zero and insert something else; -see Chapter 27 of The METAFONTbook for an example. - -! A primary expression can't begin with `primarydef'd macro: -floor((EXPR0)/(EXPR1))'. - - 0 - - div -l.13 -I'm afraid I need some sort of value in order to continue, -so I've tentatively inserted `0'. You may want to -delete this zero and insert something else; -see Chapter 27 of The METAFONTbook for an example. - ->> 0 -! Division by zero. - - div -l.13 -You're trying to divide the quantity shown above the error -message by zero. I'm going to divide it by one instead. - -! A primary expression can't begin with `>'. - - 0 - - > -l.13 - -I'm afraid I need some sort of value in order to continue, -so I've tentatively inserted `0'. You may want to -delete this zero and insert something else; -see Chapter 27 of The METAFONTbook for an example. - ->> 0 -! Division by zero. - - ) - - > -l.13 - -You're trying to divide the quantity shown above the error -message by zero. I'm going to divide it by one instead. - ->> false ->> 0 -! Not implemented: (boolean)<(known numeric). - - > -l.13 - -I'm afraid I don't know how to apply that operation to that -combination of types. Continue, and I'll return the second -argument (see above) as the result of the operation. - -! A tertiary expression can't begin with `{'. - - 0 - - { -l.14 { - % set row_class = cycler('odd', 'even') %} -I'm afraid I need some sort of value in order to continue, -so I've tentatively inserted `0'. You may want to -delete this zero and insert something else; -see Chapter 27 of The METAFONTbook for an example. - ->> false -! Isolated expression. - - { -l.14 { - % set row_class = cycler('odd', 'even') %} -I couldn't find an `=' or `:=' after the -expression that is shown above this error message, -so I guess I'll just ignore it and carry on. - -! Extra tokens will be flushed. - - { -l.14 { - % set row_class = cycler('odd', 'even') %} -I've just read as much of that statement as I could fathom, -so a semicolon should have been next. It's very puzzling... -but I'll try to get myself back together, by ignoring -everything up to the next `;'. Please insert a semicolon -now in front of anything that you don't want me to delete. -(See Chapter 27 of The METAFONTbook for an example.) - ->> -{{componant.reference}}+' -! Unknown relation will be considered false. - - < -l.17 ...'width: 192px;'>{{ componant.reference }}< - /text> -Oh dear. I can't decide if the expression above is positive, -negative, or zero. So this comparison test won't be `true'. - -! A tertiary expression can't begin with `/'. - - 0 - - / -l.17 ...width: 192px;'>{{ componant.reference }} -I'm afraid I need some sort of value in order to continue, -so I've tentatively inserted `0'. You may want to -delete this zero and insert something else; -see Chapter 27 of The METAFONTbook for an example. - -! A primary expression can't begin with `text'. - - 0 - - text -l.17 ...h: 192px;'>{{ componant.reference }} -I'm afraid I need some sort of value in order to continue, -so I've tentatively inserted `0'. You may want to -delete this zero and insert something else; -see Chapter 27 of The METAFONTbook for an example. - ->> 0 -! Division by zero. - - text -l.17 ...h: 192px;'>{{ componant.reference }} -You're trying to divide the quantity shown above the error -message by zero. I'm going to divide it by one instead. - ->> false ->> 0 -! Not implemented: (boolean)<(known numeric). - - text -l.17 ...h: 192px;'>{{ componant.reference }} -I'm afraid I don't know how to apply that operation to that -combination of types. Continue, and I'll return the second -argument (see above) as the result of the operation. - ->> 0 -! Isolated expression. - - text -l.17 ...h: 192px;'>{{ componant.reference }} -I couldn't find an `=' or `:=' after the -expression that is shown above this error message, -so I guess I'll just ignore it and carry on. - -! Extra tokens will be flushed. - - text -l.17 ...h: 192px;'>{{ componant.reference }} -I've just read as much of that statement as I could fathom, -so a semicolon should have been next. It's very puzzling... -but I'll try to get myself back together, by ignoring -everything up to the next `;'. Please insert a semicolon -now in front of anything that you don't want me to delete. -(See Chapter 27 of The METAFONTbook for an example.) - ->> -{{componant.designation}}+' -! Unknown relation will be considered false. - - < -l.18 ...idth: 432px;'>{{ componant.designation }}< - /text> -Oh dear. I can't decide if the expression above is positive, -negative, or zero. So this comparison test won't be `true'. - -! A tertiary expression can't begin with `/'. - - 0 - - / -l.18 ...dth: 432px;'>{{ componant.designation }} -I'm afraid I need some sort of value in order to continue, -so I've tentatively inserted `0'. You may want to -delete this zero and insert something else; -see Chapter 27 of The METAFONTbook for an example. - -! A primary expression can't begin with `text'. - - 0 - - text -l.18 ... 432px;'>{{ componant.designation }} -I'm afraid I need some sort of value in order to continue, -so I've tentatively inserted `0'. You may want to -delete this zero and insert something else; -see Chapter 27 of The METAFONTbook for an example. - ->> 0 -! Division by zero. - - text -l.18 ... 432px;'>{{ componant.designation }} -You're trying to divide the quantity shown above the error -message by zero. I'm going to divide it by one instead. - ->> false ->> 0 -! Not implemented: (boolean)<(known numeric). - - text -l.18 ... 432px;'>{{ componant.designation }} -I'm afraid I don't know how to apply that operation to that -combination of types. Continue, and I'll return the second -argument (see above) as the result of the operation. - ->> 0 -! Isolated expression. - - text -l.18 ... 432px;'>{{ componant.designation }} -I couldn't find an `=' or `:=' after the -expression that is shown above this error message, -so I guess I'll just ignore it and carry on. - -! Extra tokens will be flushed. - - text -l.18 ... 432px;'>{{ componant.designation }} -I've just read as much of that statement as I could fathom, -so a semicolon should have been next. It's very puzzling... -but I'll try to get myself back together, by ignoring -everything up to the next `;'. Please insert a semicolon -now in front of anything that you don't want me to delete. -(See Chapter 27 of The METAFONTbook for an example.) - ->> -{{componant.quantity}}+' -! Unknown relation will be considered false. - - < -l.19 ...e='width: 92px;'>{{ componant.quantity }}< - /text> -Oh dear. I can't decide if the expression above is positive, -negative, or zero. So this comparison test won't be `true'. - -! A tertiary expression can't begin with `/'. - - 0 - - / -l.19 ...='width: 92px;'>{{ componant.quantity }} -I'm afraid I need some sort of value in order to continue, -so I've tentatively inserted `0'. You may want to -delete this zero and insert something else; -see Chapter 27 of The METAFONTbook for an example. - -! A primary expression can't begin with `text'. - - 0 - - text -l.19 ...dth: 92px;'>{{ componant.quantity }} -I'm afraid I need some sort of value in order to continue, -so I've tentatively inserted `0'. You may want to -delete this zero and insert something else; -see Chapter 27 of The METAFONTbook for an example. - ->> 0 -! Division by zero. - - text -l.19 ...dth: 92px;'>{{ componant.quantity }} -You're trying to divide the quantity shown above the error -message by zero. I'm going to divide it by one instead. - ->> false ->> 0 -! Not implemented: (boolean)<(known numeric). - - text -l.19 ...dth: 92px;'>{{ componant.quantity }} -I'm afraid I don't know how to apply that operation to that -combination of types. Continue, and I'll return the second -argument (see above) as the result of the operation. - ->> 0 -! Isolated expression. - - text -l.19 ...dth: 92px;'>{{ componant.quantity }} -I couldn't find an `=' or `:=' after the -expression that is shown above this error message, -so I guess I'll just ignore it and carry on. - -! Extra tokens will be flushed. - - text -l.19 ...dth: 92px;'>{{ componant.quantity }} -I've just read as much of that statement as I could fathom, -so a semicolon should have been next. It's very puzzling... -but I'll try to get myself back together, by ignoring -everything up to the next `;'. Please insert a semicolon -now in front of anything that you don't want me to delete. -(See Chapter 27 of The METAFONTbook for an example.) - ->> -{{componant.place}}+' -! Unknown relation will be considered false. - - < -l.20 ...yle='width: 152px;'>{{ componant.place }}< - /text> -Oh dear. I can't decide if the expression above is positive, -negative, or zero. So this comparison test won't be `true'. - -! A tertiary expression can't begin with `/'. - - 0 - - / -l.20 ...le='width: 152px;'>{{ componant.place }} -I'm afraid I need some sort of value in order to continue, -so I've tentatively inserted `0'. You may want to -delete this zero and insert something else; -see Chapter 27 of The METAFONTbook for an example. - -! A primary expression can't begin with `text'. - - 0 - - text -l.20 ...width: 152px;'>{{ componant.place }} -I'm afraid I need some sort of value in order to continue, -so I've tentatively inserted `0'. You may want to -delete this zero and insert something else; -see Chapter 27 of The METAFONTbook for an example. - ->> 0 -! Division by zero. - - text -l.20 ...width: 152px;'>{{ componant.place }} -You're trying to divide the quantity shown above the error -message by zero. I'm going to divide it by one instead. - ->> false ->> 0 -! Not implemented: (boolean)<(known numeric). - - text -l.20 ...width: 152px;'>{{ componant.place }} -I'm afraid I don't know how to apply that operation to that -combination of types. Continue, and I'll return the second -argument (see above) as the result of the operation. - ->> 0 -! Isolated expression. - - text -l.20 ...width: 152px;'>{{ componant.place }} -I couldn't find an `=' or `:=' after the -expression that is shown above this error message, -so I guess I'll just ignore it and carry on. - -! Extra tokens will be flushed. - - text -l.20 ...width: 152px;'>{{ componant.place }} -I've just read as much of that statement as I could fathom, -so a semicolon should have been next. It's very puzzling... -but I'll try to get myself back together, by ignoring -everything up to the next `;'. Please insert a semicolon -now in front of anything that you don't want me to delete. -(See Chapter 27 of The METAFONTbook for an example.) - -! A tertiary expression can't begin with `<'. - - 0 - - < -l.22 < - text class='edit' title='Éditer' onclick='javascript:... -I'm afraid I need some sort of value in order to continue, -so I've tentatively inserted `0'. You may want to -delete this zero and insert something else; -see Chapter 27 of The METAFONTbook for an example. - ->> ' -! Unknown relation will be considered false. - - < -l.22 < - text class='edit' title='Éditer' onclick='javascript:... -Oh dear. I can't decide if the expression above is positive, -negative, or zero. So this comparison test won't be `true'. - -! A tertiary expression can't begin with `text'. - - 0 - - text -l.22 > false ->> 0 -! Not implemented: (boolean)<(known numeric). - - text -l.22 > 0 -! Isolated expression. - - text -l.22 - text -l.22 Tetastock - + diff --git a/templates/index.html b/templates/index.html index 1652b54..6386cbc 100644 --- a/templates/index.html +++ b/templates/index.html @@ -4,7 +4,7 @@ Tetastock - {% block title %}Accueil{% endblock %} - + {% block bodyheader %} @@ -17,6 +17,7 @@
{% block top_menu %} Accueil {% endblock %} +
diff --git a/templates/wip.html b/templates/wip.html index 443256e..adde760 100644 --- a/templates/wip.html +++ b/templates/wip.html @@ -4,7 +4,7 @@ Tetastock - + diff --git a/tetastock.py b/tetastock.py index fc66edf..342c599 100755 --- a/tetastock.py +++ b/tetastock.py @@ -156,6 +156,7 @@ def resume_session(func): @wraps(func) def check(*args, **kwargs): # A motherfuckin' bunch of defaults values + css='neutral' empty=u'' limit = 12 offset = 0 @@ -173,6 +174,8 @@ def resume_session(func): k_count = 0 kc_quantity = 0 kc_limit = 3 + if not u'css' in session: + session[u'css'] = css if not u'token' in session: session[u'token'] = empty if not u'password' in session: @@ -289,7 +292,7 @@ def resume_session(func): # Check for valid session if not check_user(request, session): # User is not logged in, send him back to login page - return render_template('login.html') + return render_template('login.html', css=session[u'css']) # Everything's fine return func(*args, **kwargs) return check @@ -300,13 +303,13 @@ def resume_session(func): @app.errorhandler(404) def page_not_found(e): """ 404 not found """ - return render_template('error.html'), 404 + return render_template('error.html', css=session[u'css']), 404 @app.route("/", methods=['GET', 'POST']) @resume_session def authenticate(): """ Friend or foo ? """ - response = app.make_response(render_template('index.html')) + response = app.make_response(render_template('index.html', css=session[u'css'])) sync_cookies(response, session) return response @@ -325,7 +328,8 @@ def componants(): reference=session[u'c_reference'].decode('utf8'), designation=session[u'c_designation'].decode('utf8'), place=session[u'c_place'].decode('utf8'), - provider_id=session[u'c_provider']) + provider_id=session[u'c_provider'], + css=session[u'css']) @app.route('/componants/', methods=['GET', 'POST']) @resume_session @@ -334,14 +338,18 @@ def get_componant(componant_id): try: componant_id = int(componant_id) except ValueError as e: - return render_template('error.html'), 404 + return render_template('error.html', css=session[u'css']), 404 componant = Stock_componants.query.filter_by(id=componant_id).first() if componant: providers = Stock_providers.query.order_by(Stock_providers.name).all() provider = componant.provider_id provider = Stock_providers.query.filter_by(id=provider).first() - return render_template('componant.html', componant=componant, providers=providers, provider=provider) - return render_template('error.html'), 404 + return render_template('componant.html', + componant=componant, + providers=providers, + provider=provider, + css=session[u'css']) + return render_template('error.html', css=session[u'css']), 404 @app.route('/componants/update/', methods=['POST']) @resume_session @@ -369,7 +377,7 @@ def delete_componant(componant_id): Stock_componants.query.filter_by(id=componant_id).delete() db.session.commit() except ValueError as e: - return render_template('error.html'), 404 + return render_template('error.html', css=session[u'css']), 404 except Exception as e: db.session.rollback() print "[+] Error at delete_componant:" @@ -408,13 +416,13 @@ def new_componant(): @resume_session def in_componants(): """ Incoming order """ - return render_template('wip.html') + return render_template('wip.html', css=session[u'css']) @app.route('/componants/out') @resume_session def out_componants(): """ Outgoing order """ - return render_template('wip.html') + return render_template('wip.html', css=session[u'css']) ## Componants update result set @app.route('/componants/update', methods=['GET', 'POST']) @@ -483,7 +491,8 @@ def providers(): address=session[u'p_address'].decode('utf8'), mail=session[u'p_mail'].decode('utf8'), url=session[u'p_url'].decode('utf8'), - comment=session[u'p_comment'].decode('utf8')) + comment=session[u'p_comment'].decode('utf8'), + css=session[u'css']) @app.route('/providers/') @resume_session @@ -492,11 +501,11 @@ def get_provider(provider_id): try: provider_id = int(provider_id) except ValueError as e: - return render_template('error.html'), 404 + return render_template('error.html', css=session[u'css']), 404 provider = Stock_providers.query.filter_by(id=provider_id).first() if provider: - return render_template('provider.html', provider=provider) - return render_template('error.html'), 404 + return render_template('provider.html', provider=provider, css=session[u'css']) + return render_template('error.html', css=session[u'css']), 404 @app.route('/providers/update/', methods=['POST']) @@ -548,7 +557,7 @@ def delete_provider(provider_id): Stock_providers.query.filter_by(id=provider_id).delete() db.session.commit() except ValueError as e: - return render_template('error.html'), 404 + return render_template('error.html', css=session[u'css']), 404 except Exception as e: db.session.rollback() print "[+] Error at delete_provider:" @@ -625,7 +634,8 @@ def search_providers(): def kits(): return render_template('kits.html', name=session[u'k_name'].decode('utf8'), - designation=session[u'k_designation'].decode('utf8')) + designation=session[u'k_designation'].decode('utf8'), + css=session[u'css']) @app.route('/kits/') @resume_session @@ -634,11 +644,11 @@ def get_kit(kit_id): try: kit_id = int(kit_id) except ValueError as e: - return render_template('error.html'), 404 + return render_template('error.html', css=session[u'css']), 404 kit = Stock_kits.query.filter_by(id=kit_id).first() if kit: - return render_template('kit.html', kit=kit) - return render_template('error.html'), 404 + return render_template('kit.html', kit=kit, css=session[u'css']) + return render_template('error.html', css=session[u'css']), 404 @app.route('/kits/update/', methods=['POST']) @resume_session @@ -687,7 +697,7 @@ def delete_kit(kit_id): Stock_kits.query.filter_by(id=kit_id).delete() db.session.commit() except ValueError as e: - return render_template('error.html'), 404 + return render_template('error.html', css=session[u'css']), 404 except Exception as e: db.session.rollback() print "[+] Error at delete_kit:" @@ -781,7 +791,7 @@ def remove_componant_from_kit(kit_id, componant_id): Stock_kit_compositions.query.filter_by(kit_id=kit_id).filter_by(componant_id=componant_id).delete() db.session.commit() except ValueError as e: - return render_template('error.html'), 404 + return render_template('error.html', css=session[u'css']), 404 except Exception as e: db.session.rollback() print "[+] Error at remove_componant_from_kit:" @@ -808,7 +818,7 @@ def add_componant_to_kit(kit_id): db.session.add(composition) commit = db.session.commit() except ValueError as e: - return render_template('error.html'), 404 + return render_template('error.html', css=session[u'css']), 404 except Exception as e: db.session.rollback() print "[+] Error at add_componant_to_kit:" @@ -831,7 +841,7 @@ def update_kit_composition(kit_id): composition.quantity = session[u'kc_quantity'] db.session.commit() except ValueError as e: - return render_template('error.html'), 404 + return render_template('error.html', css=session[u'css']), 404 except Exception as e: db.session.rollback() print "[+] Error at update_kit_composition:"