Merge pruning main branch changes.
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
66
app.log
66
app.log
@@ -1,66 +0,0 @@
|
||||
Request: 127.0.0.1 GET http /store/supplier_purchase_orders? Host: 127.0.0.1:5000
|
||||
|
||||
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:131.0) Gecko/20100101 Firefox/131.0
|
||||
|
||||
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/png,image/svg+xml,*/*;q=0.8
|
||||
|
||||
Accept-Language: en-GB,en;q=0.5
|
||||
|
||||
Accept-Encoding: gzip, deflate, br, zstd
|
||||
|
||||
Dnt: 1
|
||||
|
||||
Connection: keep-alive
|
||||
|
||||
Cookie: session=.eJytVlmPo0gS_isjSzNP4-rkhpJauz4xlMEGcxherITEkJw2hzHM9H_fxNU7PQ-zl7SS05AZQcQXGedvM9i1SVXjJkJ2E9Wz999mISwvEBW4vDRtVUez97buol__dNy9GD9PowLifPY-i1APa_RWYITyqK3KpsBt8vd4or6FVTH7dXbFddOWsCACZ1aE0EDOMLqEXV1HZThcUHSFXd7O3ssuz1-kOopxVf4F4RMA9cf7ZTICELmv5-88J9KBxIWixCEgQQEEkALX6DopbC4vxJdHVOMrjtDs_QrzJnpRcBnmHYrQxVlYP7R-2knITXcjqv5sfNPV3w3S_mn3_DQZPvtG7qupr5e2yqKS0Fn6ylMwgFeeQREMBAQYluy4QIhEimVoJIEIsCgiELvvboBhGDXNHxKiQU0COcQHrGbwrOD9Ss2DQpv2Sy21aRPouoJ7DM_6qKQVhjsThDuN3w9S5p-9NihRAkel11M_91O_Osg5G2COCgcuQWez0lZc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1wdicv0M540LkiXDMr1UyQjwy8k29-ZHrkbeSp1DhfpLLVtL1q46p4DvCYr7XSiFONeUpEhr3q6bDVwdaLDwwZP0k6a05yqhQuoNKq5SMfw_sjlxT3ZMdw2TSR_KdTNqGyXknFudsG9W1Ku-2HsVogV6T34OO0716lOmC0jJ0mets_1Fx1Ak1f4A19So5_c8k5cicqTbqTj5tD0uibyQJXT8SYJoIOyJH2sxYtHHVSznN-zqEhlXBQcrdIPK8tu3qEYvLslNKk2nvKmzsc5HDf2Hfu9VT-3xwvFzQcJyb4mdJA54GTvKp62cU2Scv2q6SRpUKpU0Z7e4ZmG1lZe3r1KeDbKXFHNfP2YO6r03O-sPVyqmrEzlLjty8cJp1A2NsM293Lmkkz1qwmr29QZyX-J0U-3urriPPrpc174dfYqWJd2ePEsI1iTpvfZ-3B5rV79ryPNeRbL6dDedc1dJSf8vB8E2jRGZ-cuYKSqJL9n_8sI8i9aPymp32sszTNTjcXfi64oSeDzoGmIgqRtb837ly8oeszLHmY04PnoyicifpZvXfP2mj4mVV-Iru-DwX8GVeIw-3fME0tVhhM9lErQP07mMz5eKwu157LfEvINh203DWp_IGze4ho-YAvrF5zP1y8cg5grzbJAQBzNCVeRvdJCCIEgCmyAePZvzVdWBL_UX2_xL-jrS9bPzOJnekt-ISp_2Ef2nyIb8haht1sZTx7Hk8NEOlosYk0x3BKq6z6uEpM3mCq4HYtsN-7libEL_ptZrbsh2JJpbHLGjAY0O6fAnOIsinoH_Dug3ihB8Gffvn37BzRZnhg.Zw5Mmg.gBkevkFjMnKbLNa4Z7YPzmq0RA0
|
||||
|
||||
Upgrade-Insecure-Requests: 1
|
||||
|
||||
Sec-Fetch-Dest: document
|
||||
|
||||
Sec-Fetch-Mode: navigate
|
||||
|
||||
Sec-Fetch-Site: none
|
||||
|
||||
Sec-Fetch-User: ?1
|
||||
|
||||
Sec-Gpc: 1
|
||||
|
||||
Priority: u=0, i
|
||||
|
||||
|
||||
|
||||
|
||||
Request data: b''
|
||||
Traceback: Traceback (most recent call last):
|
||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py", line 1473, in wsgi_app
|
||||
response = self.full_dispatch_request()
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py", line 882, in full_dispatch_request
|
||||
rv = self.handle_user_exception(e)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask_cors\extension.py", line 178, in wrapped_function
|
||||
return cors_after_request(app.make_response(f(*args, **kwargs)))
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py", line 880, in full_dispatch_request
|
||||
rv = self.dispatch_request()
|
||||
^^^^^^^^^^^^^^^^^^^^^^^
|
||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py", line 865, in dispatch_request
|
||||
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return]
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\controllers\store\supplier_purchase_order.py", line 43, in supplier_purchase_orders
|
||||
return render_template('pages/store/_supplier_purchase_orders.html', model = model, datetime = datetime)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\templating.py", line 150, in render_template
|
||||
return _render(app, template, context)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\templating.py", line 131, in _render
|
||||
rv = template.render(context)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\jinja2\environment.py", line 1304, in render
|
||||
self.environment.handle_exception()
|
||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\jinja2\environment.py", line 939, in handle_exception
|
||||
raise rewrite_traceback_stack(source=source)
|
||||
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\templates\pages\store\_supplier_purchase_orders.html", line 1, in top-level template code
|
||||
{% extends 'layouts/layout.html' %}
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
97
app.log.1
97
app.log.1
@@ -1,97 +0,0 @@
|
||||
Traceback: Traceback (most recent call last):
|
||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py", line 1473, in wsgi_app
|
||||
response = self.full_dispatch_request()
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py", line 882, in full_dispatch_request
|
||||
rv = self.handle_user_exception(e)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask_cors\extension.py", line 178, in wrapped_function
|
||||
return cors_after_request(app.make_response(f(*args, **kwargs)))
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py", line 880, in full_dispatch_request
|
||||
rv = self.dispatch_request()
|
||||
^^^^^^^^^^^^^^^^^^^^^^^
|
||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py", line 865, in dispatch_request
|
||||
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return]
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\controllers\store\supplier_purchase_order.py", line 43, in supplier_purchase_orders
|
||||
return render_template('pages/store/_supplier_purchase_orders.html', model = model, datetime = datetime)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\templating.py", line 150, in render_template
|
||||
return _render(app, template, context)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\templating.py", line 131, in _render
|
||||
rv = template.render(context)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\jinja2\environment.py", line 1304, in render
|
||||
self.environment.handle_exception()
|
||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\jinja2\environment.py", line 939, in handle_exception
|
||||
raise rewrite_traceback_stack(source=source)
|
||||
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\templates\pages\store\_supplier_purchase_orders.html", line 1, in top-level template code
|
||||
{% extends 'layouts/layout.html' %}
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\templates\layouts\layout.html", line 329, in top-level template code
|
||||
{% block page_body %}{% endblock %}
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\templates\pages\store\_supplier_purchase_orders.html", line 55, in block 'page_body'
|
||||
{% include 'components/store/_row_supplier_purchase_order.html' %}
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\templates\components\store\_row_supplier_purchase_order.html", line 62, in top-level template code
|
||||
{% include 'components/store/_preview_order_items.html' %}
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\templates\components\store\_preview_order_items.html", line 4, in top-level template code
|
||||
{% set str_items = model.convert_list_objects_to_preview_str(order_items) %}
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\models\model_view_base.py", line 366, in convert_list_objects_to_preview_str
|
||||
preview_str += obj_json[obj_json[Base.FLAG_NAME_ATTR_OPTION_TEXT]]
|
||||
TypeError: can only concatenate str (not "NoneType") to str
|
||||
|
||||
Exception on /store/supplier_purchase_orders [GET]
|
||||
Traceback (most recent call last):
|
||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py", line 1473, in wsgi_app
|
||||
response = self.full_dispatch_request()
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py", line 882, in full_dispatch_request
|
||||
rv = self.handle_user_exception(e)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask_cors\extension.py", line 178, in wrapped_function
|
||||
return cors_after_request(app.make_response(f(*args, **kwargs)))
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py", line 880, in full_dispatch_request
|
||||
rv = self.dispatch_request()
|
||||
^^^^^^^^^^^^^^^^^^^^^^^
|
||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py", line 865, in dispatch_request
|
||||
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return]
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\controllers\store\supplier_purchase_order.py", line 43, in supplier_purchase_orders
|
||||
return render_template('pages/store/_supplier_purchase_orders.html', model = model, datetime = datetime)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\templating.py", line 150, in render_template
|
||||
return _render(app, template, context)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\templating.py", line 131, in _render
|
||||
rv = template.render(context)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\jinja2\environment.py", line 1304, in render
|
||||
self.environment.handle_exception()
|
||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\jinja2\environment.py", line 939, in handle_exception
|
||||
raise rewrite_traceback_stack(source=source)
|
||||
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\templates\pages\store\_supplier_purchase_orders.html", line 1, in top-level template code
|
||||
{% extends 'layouts/layout.html' %}
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\templates\layouts\layout.html", line 329, in top-level template code
|
||||
{% block page_body %}{% endblock %}
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\templates\pages\store\_supplier_purchase_orders.html", line 55, in block 'page_body'
|
||||
{% include 'components/store/_row_supplier_purchase_order.html' %}
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\templates\components\store\_row_supplier_purchase_order.html", line 62, in top-level template code
|
||||
{% include 'components/store/_preview_order_items.html' %}
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\templates\components\store\_preview_order_items.html", line 4, in top-level template code
|
||||
{% set str_items = model.convert_list_objects_to_preview_str(order_items) %}
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\models\model_view_base.py", line 367, in convert_list_objects_to_preview_str
|
||||
preview_str += obj_json[obj_json[Base.FLAG_NAME_ATTR_OPTION_TEXT]]
|
||||
TypeError: can only concatenate str (not "NoneType") to str
|
||||
Server Error: 500 Internal Server Error: The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.
|
||||
67
app.log.2
67
app.log.2
@@ -1,67 +0,0 @@
|
||||
Exception on /store/supplier_purchase_orders [GET]
|
||||
Traceback (most recent call last):
|
||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py", line 1473, in wsgi_app
|
||||
response = self.full_dispatch_request()
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py", line 882, in full_dispatch_request
|
||||
rv = self.handle_user_exception(e)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask_cors\extension.py", line 178, in wrapped_function
|
||||
return cors_after_request(app.make_response(f(*args, **kwargs)))
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py", line 880, in full_dispatch_request
|
||||
rv = self.dispatch_request()
|
||||
^^^^^^^^^^^^^^^^^^^^^^^
|
||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py", line 865, in dispatch_request
|
||||
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return]
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\controllers\store\supplier_purchase_order.py", line 43, in supplier_purchase_orders
|
||||
return render_template('pages/store/_supplier_purchase_orders.html', model = model, datetime = datetime)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\templating.py", line 150, in render_template
|
||||
return _render(app, template, context)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\templating.py", line 131, in _render
|
||||
rv = template.render(context)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\jinja2\environment.py", line 1304, in render
|
||||
self.environment.handle_exception()
|
||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\jinja2\environment.py", line 939, in handle_exception
|
||||
raise rewrite_traceback_stack(source=source)
|
||||
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\templates\pages\store\_supplier_purchase_orders.html", line 1, in top-level template code
|
||||
{% extends 'layouts/layout.html' %}
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\templates\layouts\layout.html", line 329, in top-level template code
|
||||
{% block page_body %}{% endblock %}
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\templates\pages\store\_supplier_purchase_orders.html", line 55, in block 'page_body'
|
||||
{% include 'components/store/_row_supplier_purchase_order.html' %}
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\templates\components\store\_row_supplier_purchase_order.html", line 62, in top-level template code
|
||||
{% include 'components/store/_preview_order_items.html' %}
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\templates\components\store\_preview_order_items.html", line 4, in top-level template code
|
||||
{% set str_items = model.convert_list_objects_to_preview_str(order_items) %}
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\models\model_view_base.py", line 366, in convert_list_objects_to_preview_str
|
||||
preview_str += obj_json[obj_json[Base.FLAG_NAME_ATTR_OPTION_TEXT]]
|
||||
TypeError: can only concatenate str (not "NoneType") to str
|
||||
Server Error: 500 Internal Server Error: The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.
|
||||
Request: 127.0.0.1 GET http /store/supplier_purchase_orders? Host: 127.0.0.1:5000
|
||||
|
||||
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:131.0) Gecko/20100101 Firefox/131.0
|
||||
|
||||
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/png,image/svg+xml,*/*;q=0.8
|
||||
|
||||
Accept-Language: en-GB,en;q=0.5
|
||||
|
||||
Accept-Encoding: gzip, deflate, br, zstd
|
||||
|
||||
Dnt: 1
|
||||
|
||||
Connection: keep-alive
|
||||
|
||||
Cookie: session=.eJytVlmPo0gS_isjSzNP4-rkhpJauz4xlMEGcxherITEkJw2hzHM9H_fxNU7PQ-zl7SS05AZQcQXGedvM9i1SVXjJkJ2E9Wz999mISwvEBW4vDRtVUez97buol__dNy9GD9PowLifPY-i1APa_RWYITyqK3KpsBt8vd4or6FVTH7dXbFddOWsCACZ1aE0EDOMLqEXV1HZThcUHSFXd7O3ssuz1-kOopxVf4F4RMA9cf7ZTICELmv5-88J9KBxIWixCEgQQEEkALX6DopbC4vxJdHVOMrjtDs_QrzJnpRcBnmHYrQxVlYP7R-2knITXcjqv5sfNPV3w3S_mn3_DQZPvtG7qupr5e2yqKS0Fn6ylMwgFeeQREMBAQYluy4QIhEimVoJIEIsCgiELvvboBhGDXNHxKiQU0COcQHrGbwrOD9Ss2DQpv2Sy21aRPouoJ7DM_6qKQVhjsThDuN3w9S5p-9NihRAkel11M_91O_Osg5G2COCgcuQWez0lZcGtDgoZTg7W0oBc5otrzXDqu8iddvV09uj1ogXwJa0VQxKfrs2C027eqYMBifGxrGHs_tYk-iF8meEbcnES_sPFnsPqB3EW5BbN5KzhFyLQIDYJXgw7UHFVIV6psxbGst61vzylrNXB2P8hVsLp07r3YZjBXfWPODVFeAt8qnHozuvTO4fMyhuwP5gV0Ix9DY4E7mH4LffRz7B3U4fOyzA3JXOF0Ez5Ode_rJ9J15fF5IThSXueiLmh1Tsrk2536wcj22rJbzLKXlZoMzd64m7HzVwr3dczBuCt6P5h9Pbuse093c3oFtv0G7PAa0F9BPNVvKiahD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SRpUKpU0Z7e4ZmG1lZe3r1KeDbKXFHNfP2YO6r03O-sPVyqmrEzlLjty8cJp1A2NsM293Lmkkz1qwmr29QZyX-J0U-3urriPPrpc174dfYqWJd2ePEsI1iTpvfZ-3B5rV79ryPNeRbL6dDedc1dJSf8vB8E2jRGZ-cuYKSqJL9n_8sI8i9aPymp32sszTNTjcXfi64oSeDzoGmIgqRtb837ly8oeszLHmY04PnoyicifpZvXfP2mj4mVV-Iru-DwX8GVeIw-3fME0tVhhM9lErQP07mMz5eKwu157LfEvINh203DWp_IGze4ho-YAvrF5zP1y8cg5grzbJAQBzNCVeRvdJCCIEgCmyAePZvzVdWBL_UX2_xL-jrS9bPzOJnekt-ISp_2Ef2nyIb8haht1sZTx7Hk8NEOlosYk0x3BKq6z6uEpM3mCq4HYtsN-7libEL_ptZrbsh2JJpbHLGjAY0O6fAnOIsinoH_Dug3ihB8Gffvn37BzRZnhg.Zw5Mmg.gBkevkFjMnKbLNa4Z7YPzmq0RA0
|
||||
|
||||
Upgrade-Insecure-Requests: 1
|
||||
|
||||
66
app.log.3
66
app.log.3
@@ -1,66 +0,0 @@
|
||||
Request: 127.0.0.1 GET http /store/supplier_purchase_orders? Host: 127.0.0.1:5000
|
||||
|
||||
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:131.0) Gecko/20100101 Firefox/131.0
|
||||
|
||||
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/png,image/svg+xml,*/*;q=0.8
|
||||
|
||||
Accept-Language: en-GB,en;q=0.5
|
||||
|
||||
Accept-Encoding: gzip, deflate, br, zstd
|
||||
|
||||
Dnt: 1
|
||||
|
||||
Connection: keep-alive
|
||||
|
||||
Cookie: session=.eJytVlmPo0gS_isjSzNP4-rkhpJauz4xlMEGcxherITEkJw2hzHM9H_fxNU7PQ-zl7SS05AZQcQXGedvM9i1SVXjJkJ2E9Wz999mISwvEBW4vDRtVUez97buol__dNy9GD9PowLifPY-i1APa_RWYITy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EOlosYk0x3BKq6z6uEpM3mCq4HYtsN-7libEL_ptZrbsh2JJpbHLGjAY0O6fAnOIsinoH_Dug3ihB8Gffvn37BzRZnhg.Zw5Mmg.gBkevkFjMnKbLNa4Z7YPzmq0RA0
|
||||
|
||||
Upgrade-Insecure-Requests: 1
|
||||
|
||||
Sec-Fetch-Dest: document
|
||||
|
||||
Sec-Fetch-Mode: navigate
|
||||
|
||||
Sec-Fetch-Site: none
|
||||
|
||||
Sec-Fetch-User: ?1
|
||||
|
||||
Sec-Gpc: 1
|
||||
|
||||
Priority: u=0, i
|
||||
|
||||
|
||||
|
||||
|
||||
Request data: b''
|
||||
Traceback: Traceback (most recent call last):
|
||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py", line 1473, in wsgi_app
|
||||
response = self.full_dispatch_request()
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py", line 882, in full_dispatch_request
|
||||
rv = self.handle_user_exception(e)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask_cors\extension.py", line 178, in wrapped_function
|
||||
return cors_after_request(app.make_response(f(*args, **kwargs)))
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py", line 880, in full_dispatch_request
|
||||
rv = self.dispatch_request()
|
||||
^^^^^^^^^^^^^^^^^^^^^^^
|
||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py", line 865, in dispatch_request
|
||||
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return]
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\controllers\store\supplier_purchase_order.py", line 43, in supplier_purchase_orders
|
||||
return render_template('pages/store/_supplier_purchase_orders.html', model = model, datetime = datetime)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\templating.py", line 150, in render_template
|
||||
return _render(app, template, context)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\templating.py", line 131, in _render
|
||||
rv = template.render(context)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\jinja2\environment.py", line 1304, in render
|
||||
self.environment.handle_exception()
|
||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\jinja2\environment.py", line 939, in handle_exception
|
||||
raise rewrite_traceback_stack(source=source)
|
||||
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\templates\pages\store\_supplier_purchase_orders.html", line 1, in top-level template code
|
||||
{% extends 'layouts/layout.html' %}
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
182
pay_stripe.py
182
pay_stripe.py
@@ -1,182 +0,0 @@
|
||||
"""
|
||||
Project: PARTS Website
|
||||
Author: Edward Middleton-Smith
|
||||
Precision And Research Technology Systems Limited
|
||||
|
||||
Technology: App General
|
||||
Feature: App
|
||||
|
||||
Description:
|
||||
Initializes the Flask application, sets the configuration based on the environment, and defines two routes (/ and /about) that render templates with the specified titles.
|
||||
"""
|
||||
|
||||
# IMPORTS
|
||||
# VARIABLE INSTANTIATION
|
||||
# METHODS
|
||||
|
||||
# IMPORTS
|
||||
import os
|
||||
import stripe
|
||||
import json
|
||||
from flask import Flask, render_template, render_template_string, jsonify, request, send_from_directory, redirect
|
||||
from dotenv import load_dotenv, find_dotenv
|
||||
|
||||
from config import app_config
|
||||
|
||||
# VARIABLE INSTANTIATION
|
||||
key_secret = os.environ.get("KEY_SECRET_STRIPE")
|
||||
key_public = os.environ.get("KEY_PUBLIC_STRIPE") # 'pk_test_51OGrxlL7BuLKjoMpfpfw7bSmZZK1MhqMoQ5VhW2jUj7YtoEejO4vqnxKPiqTHHuh9U4qqkywbPCSI9TpFKtr4SYH007KHMWs68'
|
||||
|
||||
# METHODS
|
||||
def create_product_price():
|
||||
print(f'stripe.api_key = {stripe.api_key}')
|
||||
starter_subscription = stripe.Product.create(
|
||||
name="Starter Subscription",
|
||||
description="$12/Month subscription",
|
||||
)
|
||||
|
||||
starter_subscription_price = stripe.Price.create(
|
||||
unit_amount=1200,
|
||||
currency="usd",
|
||||
recurring={"interval": "month"},
|
||||
product=starter_subscription['id'],
|
||||
)
|
||||
|
||||
# Save these identifiers
|
||||
print(f"Success! Here is your starter subscription product id: {starter_subscription.id}")
|
||||
print(f"Success! Here is your starter subscription price id: {starter_subscription_price.id}")
|
||||
|
||||
return starter_subscription_price.id
|
||||
|
||||
def get_file_str(f_address):
|
||||
f = open(f_address)
|
||||
return f.read()
|
||||
|
||||
# Ensure environment variables are set.
|
||||
price = os.getenv('PRICE')
|
||||
if price is None or price == 'price_12345' or price == '':
|
||||
print('You must set a Price ID in .env. Please see the README.')
|
||||
exit(0)
|
||||
|
||||
# For sample support and debugging, not required for production:
|
||||
stripe.set_app_info(
|
||||
'stripe-samples/checkout-one-time-payments',
|
||||
version='0.0.1',
|
||||
url='https://github.com/stripe-samples/checkout-one-time-payments')
|
||||
|
||||
# stripe.api_version = '2020-08-27'
|
||||
stripe.api_key = key_secret # os.getenv('KEY_SECRET_STRIPE')
|
||||
|
||||
# app_dir = str(os.path.abspath(os.path.join(
|
||||
# __file__, "..", "..")))
|
||||
# static_dir = str(os.path.abspath(os.path.join(
|
||||
# app_dir, os.getenv("STATIC_DIR"))))
|
||||
# template_dir = str(os.path.abspath(os.path.join(
|
||||
# app_dir, os.getenv("TEMPLATE_DIR"))))
|
||||
app = Flask(__name__) # , static_folder=static_dir,
|
||||
# static_url_path="", template_folder=template_dir)
|
||||
app.config.from_object(app_config)
|
||||
|
||||
@app.route('/', methods=['GET'])
|
||||
def home():
|
||||
# return render_template(f'{app_dir}\\templates\\_home.html') # f'{app_dir}\\templates\\layout.html')
|
||||
# return render_template_string(get_file_str(f'{app_dir}\\templates\\_home.html')) # f'{app_dir}\\templates\\layout.html')
|
||||
return render_template('_home.html', title='Home')
|
||||
|
||||
@app.route('/store', methods=['GET'])
|
||||
def store_home():
|
||||
return render_template('_store_home.html', title='Store Home')
|
||||
|
||||
@app.route('/contact')
|
||||
def contact():
|
||||
return render_template('_contact.html', title='Contact Us')
|
||||
|
||||
|
||||
@app.route('/config', methods=['GET'])
|
||||
def get_publishable_key():
|
||||
price = stripe.Price.retrieve(os.getenv('PRICE'))
|
||||
return jsonify({
|
||||
'publicKey': key_public, # os.getenv('KEY_PUBLIC_STRIPE'),
|
||||
'unitAmount': price['unit_amount'],
|
||||
'currency': price['currency']
|
||||
})
|
||||
|
||||
# Fetch the Checkout Session to display the JSON result on the success page
|
||||
@app.route('/checkout-session', methods=['GET'])
|
||||
def get_checkout_session():
|
||||
id = request.args.get('sessionId')
|
||||
print(f'checkout session id: {id}')
|
||||
checkout_session = stripe.checkout.Session.retrieve(id)
|
||||
return jsonify(checkout_session)
|
||||
|
||||
|
||||
@app.route('/create-checkout-session', methods=['POST'])
|
||||
def create_checkout_session():
|
||||
quantity = request.form.get('quantity', 1)
|
||||
domain_url = os.getenv('DOMAIN')
|
||||
|
||||
try:
|
||||
# Create new Checkout Session for the order
|
||||
# Other optional params include:
|
||||
# [billing_address_collection] - to display billing address details on the page
|
||||
# [customer] - if you have an existing Stripe Customer ID
|
||||
# [payment_intent_data] - lets capture the payment later
|
||||
# [customer_email] - lets you prefill the email input in the form
|
||||
# [automatic_tax] - to automatically calculate sales tax, VAT and GST in the checkout page
|
||||
# For full details see https://stripe.com/docs/api/checkout/sessions/create
|
||||
|
||||
# ?session_id={CHECKOUT_SESSION_ID} means the redirect will have the session ID set as a query param
|
||||
checkout_session = stripe.checkout.Session.create(
|
||||
success_url=domain_url + '/success.html?session_id={CHECKOUT_SESSION_ID}',
|
||||
cancel_url=domain_url + '/canceled.html',
|
||||
mode='subscription', # 'payment',
|
||||
# automatic_tax={'enabled': True},
|
||||
line_items=[{
|
||||
'price': os.getenv('PRICE'),
|
||||
'quantity': quantity,
|
||||
}]
|
||||
)
|
||||
return redirect(checkout_session.url, code=303)
|
||||
except Exception as e:
|
||||
return jsonify(error=str(e)), 403
|
||||
|
||||
|
||||
@app.route('/webhook', methods=['POST'])
|
||||
def webhook_received():
|
||||
# You can use webhooks to receive information about asynchronous payment events.
|
||||
# For more about our webhook events check out https://stripe.com/docs/webhooks.
|
||||
webhook_secret = os.getenv('STRIPE_WEBHOOK_SECRET')
|
||||
request_data = json.loads(request.data)
|
||||
|
||||
if webhook_secret:
|
||||
# Retrieve the event by verifying the signature using the raw body and secret if webhook signing is configured.
|
||||
signature = request.headers.get('stripe-signature')
|
||||
try:
|
||||
event = stripe.Webhook.construct_event(
|
||||
payload=request.data, sig_header=signature, secret=webhook_secret)
|
||||
data = event['data']
|
||||
except Exception as e:
|
||||
return e
|
||||
# Get the type of webhook event sent - used to check the status of PaymentIntents.
|
||||
event_type = event['type']
|
||||
else:
|
||||
data = request_data['data']
|
||||
event_type = request_data['type']
|
||||
data_object = data['object']
|
||||
|
||||
print('event ' + event_type)
|
||||
|
||||
if event_type == 'checkout.session.completed':
|
||||
print('🔔 Payment succeeded!')
|
||||
|
||||
return jsonify({Model_View_Base.FLAG_STATUS: Model_View_Base.FLAG_SUCCESS})
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
# stripe.api_key = key_secret
|
||||
|
||||
# create_product_price()
|
||||
|
||||
# Setup Stripe python client library.
|
||||
load_dotenv(find_dotenv())
|
||||
app.run(port=4242, debug=True)
|
||||
54
routes.py
54
routes.py
@@ -1,54 +0,0 @@
|
||||
"""
|
||||
Project: PARTS Website
|
||||
Author: Edward Middleton-Smith
|
||||
Precision And Research Technology Systems Limited
|
||||
|
||||
Technology: Backend
|
||||
Feature: Controller - Webpage routing
|
||||
|
||||
Description:
|
||||
Defines the routes and view functions for each page.
|
||||
Manages the interaction between the frontend and backend.
|
||||
"""
|
||||
|
||||
from flask import render_template, url_for, Blueprint
|
||||
from app import app
|
||||
from app.forms import Form_Contact
|
||||
# from forms import MyForm
|
||||
# from app import MyForm
|
||||
from model_view_contact import Model_View_Contact
|
||||
|
||||
"""
|
||||
@app.route('/', methods=['GET'])
|
||||
def home():
|
||||
return render_template('_home.html', title='Home')
|
||||
|
||||
@app.route('/store', methods=['GET'])
|
||||
def store_home():
|
||||
return render_template('_store_home.html', title='Store Home')
|
||||
|
||||
@app.route('/contact', methods=['GET', 'POST'])
|
||||
def contact():
|
||||
form = Form_Contact()
|
||||
if form.validate_on_submit():
|
||||
# Handle form submission
|
||||
email = form.sender_email.data
|
||||
CC = form.sender_CC.data
|
||||
name = form.sender_name.data
|
||||
msg = form.sender_message.data
|
||||
# return render_template('contact.html', form=form)
|
||||
# return render_template('_contact.html', title='Contact Us')
|
||||
return render_template('contact.html', model=Model_View_Contact(form))
|
||||
|
||||
@app.route('/about')
|
||||
def about():
|
||||
return render_template('about.html')
|
||||
|
||||
@app.route('/contact', methods=['GET', 'POST'])
|
||||
def contact():
|
||||
form = MyForm()
|
||||
if form.validate_on_submit():
|
||||
# Handle form submission
|
||||
pass
|
||||
return render_template('contact.html', form=form)
|
||||
"""
|
||||
Reference in New Issue
Block a user