Fix: Console outputs suppressed when not in debug mode to fix server errors caused by unnecessary outputs.
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -55,7 +55,7 @@ secrets.yaml
|
||||
TODO.md
|
||||
|
||||
# Ignore all files in a directory
|
||||
temp_files/
|
||||
tmp/
|
||||
|
||||
# Ignore all .txt files in the doc/ directory
|
||||
doc/*.txt
|
||||
|
||||
11
app.py
11
app.py
@@ -18,7 +18,6 @@ Initializes the Flask application, sets the configuration based on the environme
|
||||
# internal
|
||||
from config import app_config, Config
|
||||
# from routes import bp_home
|
||||
from extensions import db, csrf, cors, mail, oauth
|
||||
"""
|
||||
from forms import Form_Contact, Form_Supplier, Form_Filters_Permutation, Filters_Stock_Item
|
||||
from models.model_view_base import Model_View_Base
|
||||
@@ -48,6 +47,8 @@ from controllers.store.stock_item import routes_store_stock_item
|
||||
from controllers.store.supplier import routes_store_supplier
|
||||
from controllers.store.supplier_purchase_order import routes_store_supplier_purchase_order
|
||||
from controllers.user import routes_user
|
||||
from extensions import db, csrf, cors, mail, oauth
|
||||
from helpers.helper_app import Helper_App
|
||||
# external
|
||||
from flask import Flask, render_template, jsonify, request, render_template_string, send_from_directory, redirect, url_for, session
|
||||
# from flask_appconfig import AppConfig
|
||||
@@ -74,10 +75,10 @@ app.config.from_object(app_config) # for db init with required keys
|
||||
|
||||
# logging
|
||||
handler = RotatingFileHandler('app.log', maxBytes=10000, backupCount=3)
|
||||
handler.setLevel(logging.ERROR)
|
||||
handler.setLevel(logging.DEBUG)
|
||||
app.logger.addHandler(handler)
|
||||
|
||||
@app.errorhandler(500)
|
||||
@app.errorhandler(Exception)
|
||||
def internal_server_error(error):
|
||||
app.logger.error('Server Error: %s', (error))
|
||||
app.logger.error('Request: %s %s %s %s %s',
|
||||
@@ -88,7 +89,7 @@ def internal_server_error(error):
|
||||
request.headers)
|
||||
app.logger.error('Request data: %s', request.get_data())
|
||||
app.logger.error('Traceback: %s', traceback.format_exc())
|
||||
return "500 Internal Server Error", 500
|
||||
return "Internal Server Error", 500
|
||||
|
||||
|
||||
"""
|
||||
@@ -140,5 +141,5 @@ app.register_blueprint(routes_user)
|
||||
|
||||
@app.template_filter('console_log')
|
||||
def console_log(value):
|
||||
print(value)
|
||||
Helper_App.console_log(value)
|
||||
return value
|
||||
Binary file not shown.
Binary file not shown.
@@ -15,6 +15,7 @@ import lib.argument_validation as av
|
||||
from business_objects.base import Base
|
||||
from business_objects.region import Region
|
||||
from extensions import db
|
||||
from helpers.helper_app import Helper_App
|
||||
# external
|
||||
from typing import ClassVar
|
||||
from flask import jsonify
|
||||
@@ -92,7 +93,7 @@ class Address(db.Model, Base):
|
||||
return jsonify(self.to_json())
|
||||
@classmethod
|
||||
def from_json(cls, json):
|
||||
print(f'{cls.__name__}.from_json: {json}')
|
||||
Helper_App.console_log(f'{cls.__name__}.from_json: {json}')
|
||||
address = cls()
|
||||
address.id_address = json[cls.ATTR_ID_ADDRESS],
|
||||
address.region = Region.from_json(json[cls.FLAG_REGION]),
|
||||
|
||||
@@ -14,6 +14,7 @@ Business object for address region
|
||||
import lib.argument_validation as av
|
||||
from business_objects.base import Base
|
||||
from extensions import db
|
||||
from helpers.helper_app import Helper_App
|
||||
# external
|
||||
from typing import ClassVar
|
||||
|
||||
@@ -61,7 +62,7 @@ class Region(db.Model, Base):
|
||||
}
|
||||
@classmethod
|
||||
def from_json(cls, json):
|
||||
print(f'{cls.__name__}.from_json: {json}')
|
||||
Helper_App.console_log(f'{cls.__name__}.from_json: {json}')
|
||||
plant = cls()
|
||||
plant.id_region = json[cls.ATTR_ID_REGION]
|
||||
plant.code = json[cls.FLAG_CODE]
|
||||
|
||||
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.
@@ -14,6 +14,7 @@ Business object for product
|
||||
import lib.argument_validation as av
|
||||
from business_objects.store.store_base import Store_Base
|
||||
from extensions import db
|
||||
from helpers.helper_app import Helper_App
|
||||
# external
|
||||
from pydantic import BaseModel
|
||||
from typing import ClassVar
|
||||
@@ -73,7 +74,7 @@ class Access_Level(db.Model, Store_Base):
|
||||
}
|
||||
@classmethod
|
||||
def from_json(cls, json):
|
||||
print(f'Access Level.from_json: {json}')
|
||||
Helper_App.console_log(f'Access Level.from_json: {json}')
|
||||
access_level = cls()
|
||||
access_level.id_access_level = json[cls.ATTR_ID_ACCESS_LEVEL],
|
||||
access_level.code = json[cls.FLAG_CODE],
|
||||
|
||||
@@ -27,6 +27,7 @@ from business_objects.store.store_base import Store_Base
|
||||
# from models.model_view_store import Model_View_Store # circular
|
||||
# from datastores.datastore_store import DataStore_Store # circular
|
||||
# from forms import Form_Basket_Add, Form_Basket_Edit # possibly circular
|
||||
from helpers.helper_app import Helper_App
|
||||
# external
|
||||
# from enum import Enum
|
||||
from flask import jsonify
|
||||
@@ -138,8 +139,8 @@ class Basket(Store_Base):
|
||||
quantities_permutation += ','
|
||||
ids_permutation += str(product.get_id_permutation())
|
||||
quantities_permutation += str(basket_item.quantity)
|
||||
print(f'ids_permutation_basket = {ids_permutation}')
|
||||
print(f'quantities_permutation_basket = {quantities_permutation}')
|
||||
Helper_App.console_log(f'ids_permutation_basket = {ids_permutation}')
|
||||
Helper_App.console_log(f'quantities_permutation_basket = {quantities_permutation}')
|
||||
return ids_permutation, quantities_permutation
|
||||
def to_json_list(self):
|
||||
json_list = []
|
||||
@@ -170,7 +171,7 @@ class Basket(Store_Base):
|
||||
def __repr__(self):
|
||||
repr = f'Basket:'
|
||||
for basket_item in self.items:
|
||||
print(f'{basket_item}')
|
||||
Helper_App.console_log(f'{basket_item}')
|
||||
repr = f'{repr}\n{basket_item}'
|
||||
return repr
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ Business object for product image
|
||||
# internal
|
||||
from business_objects.store.store_base import Store_Base
|
||||
from extensions import db
|
||||
from helpers.helper_app import Helper_App
|
||||
import lib.argument_validation as av
|
||||
# external
|
||||
from enum import Enum
|
||||
@@ -79,7 +80,7 @@ class Image(db.Model, Store_Base):
|
||||
"""
|
||||
def from_DB_get_many_product_catalogue(query_row):
|
||||
_m = 'Image.from_DB_get_many_product_catalogue'
|
||||
# print(f'image: {query_row}')
|
||||
# Helper_App.console_log(f'image: {query_row}')
|
||||
image = Image()
|
||||
image.id_image = query_row[0]
|
||||
image.id_product = query_row[1]
|
||||
|
||||
@@ -16,6 +16,7 @@ from business_objects.currency import Currency
|
||||
from business_objects.db_base import Get_Many_Parameters_Base
|
||||
from business_objects.store.store_base import Store_Base
|
||||
from extensions import db
|
||||
from helpers.helper_app import Helper_App
|
||||
# external
|
||||
from pydantic import BaseModel
|
||||
from typing import ClassVar, Optional
|
||||
@@ -89,7 +90,7 @@ class Manufacturing_Purchase_Order(db.Model, Store_Base):
|
||||
}
|
||||
@classmethod
|
||||
def from_json(cls, json):
|
||||
print(f'{cls.__name__}.from_json: {json}')
|
||||
Helper_App.console_log(f'{cls.__name__}.from_json: {json}')
|
||||
manufacturing_purchase_order = cls()
|
||||
manufacturing_purchase_order.id_order = json[cls.ATTR_ID_MANUFACTURING_PURCHASE_ORDER]
|
||||
manufacturing_purchase_order.id_currency = json[cls.ATTR_ID_CURRENCY]
|
||||
@@ -199,7 +200,7 @@ class Manufacturing_Purchase_Order_Product_Link(db.Model, Store_Base):
|
||||
}
|
||||
@classmethod
|
||||
def from_json(cls, json):
|
||||
print(f'{cls.__name__}.from_json: {json}')
|
||||
Helper_App.console_log(f'{cls.__name__}.from_json: {json}')
|
||||
link = cls()
|
||||
link.id_link = json[cls.ATTR_ID_MANUFACTURING_PURCHASE_ORDER_PRODUCT_LINK]
|
||||
link.id_order = json[cls.ATTR_ID_MANUFACTURING_PURCHASE_ORDER]
|
||||
|
||||
@@ -15,6 +15,7 @@ import lib.argument_validation as av
|
||||
from business_objects.address import Address
|
||||
from business_objects.store.store_base import Store_Base
|
||||
from extensions import db
|
||||
from helpers.helper_app import Helper_App
|
||||
# external
|
||||
from typing import ClassVar
|
||||
|
||||
@@ -81,7 +82,7 @@ class Plant(db.Model, Store_Base):
|
||||
}
|
||||
@classmethod
|
||||
def from_json(cls, json):
|
||||
print(f'{cls.__name__}.from_json: {json}')
|
||||
Helper_App.console_log(f'{cls.__name__}.from_json: {json}')
|
||||
plant = cls()
|
||||
plant.id_plant = json[cls.ATTR_ID_PLANT],
|
||||
plant.code = json[cls.FLAG_CODE],
|
||||
|
||||
@@ -28,6 +28,7 @@ from business_objects.store.product_variation_tree import Product_Variation_Tree
|
||||
from extensions import db
|
||||
from forms.base import Form_Base
|
||||
from forms.store.product import Filters_Product
|
||||
from helpers.helper_app import Helper_App
|
||||
# external
|
||||
from dataclasses import dataclass
|
||||
from typing import ClassVar, List
|
||||
@@ -141,7 +142,7 @@ class Product(SQLAlchemy_ABC, Store_Base):
|
||||
"""
|
||||
if self.index_permutation_selected is None:
|
||||
self.index_permutation_selected = self.permutation_index[permutation.id_permutation]
|
||||
print(f'setting selected permutation for product {self.id_product} to {self.index_permutation_selected}') # :\n{self.permutations[self.index_permutation_selected]}
|
||||
Helper_App.console_log(f'setting selected permutation for product {self.id_product} to {self.index_permutation_selected}') # :\n{self.permutations[self.index_permutation_selected]}
|
||||
"""
|
||||
def from_permutations(permutations):
|
||||
_m = 'Product.from_permutations'
|
||||
@@ -273,7 +274,7 @@ class Product(SQLAlchemy_ABC, Store_Base):
|
||||
"""
|
||||
def add_product_variation(self, variation):
|
||||
av.val_instance(variation, 'variation', 'Product.add_product_variation', Product_Variation)
|
||||
# print(f'variation: {variation}')
|
||||
# Helper_App.console_log(f'variation: {variation}')
|
||||
index_permutation = self.permutation_index[variation.id_permutation] # self.get_index_permutation_from_id(variation.id_permutation)
|
||||
self.permutations[index_permutation].add_product_variation(variation)
|
||||
def add_product_price(self, price):
|
||||
@@ -493,7 +494,7 @@ class Parameters_Product(Get_Many_Parameters_Base):
|
||||
has_category_filter = not (form.id_category.data == '0' or form.id_category.data == '' or form.id_category.data is None)
|
||||
has_product_filter = not (form.id_product.data == '0' or form.id_product.data == '' or form.id_product.data is None)
|
||||
get_permutations_stock_below_min = av.input_bool(form.is_out_of_stock.data, "is_out_of_stock", "Parameters_Product.from_form")
|
||||
print(f'form question: {type(form.is_out_of_stock)}\nbool interpretted: {get_permutations_stock_below_min}\ntype form: {type(form)}')
|
||||
Helper_App.console_log(f'form question: {type(form.is_out_of_stock)}\nbool interpretted: {get_permutations_stock_below_min}\ntype form: {type(form)}')
|
||||
return Parameters_Product(
|
||||
get_all_product_category = not has_category_filter,
|
||||
get_inactive_product_category = False,
|
||||
@@ -727,7 +728,7 @@ class Parameters_Product(Get_Many_Parameters_Base):
|
||||
has_category_filter = not (form.id_category.data is None or form.id_category.data == '0' or form.id_category.data == '')
|
||||
has_product_filter = not (form.id_product.data is None or form.id_product.data == '0' or form.id_product.data == '')
|
||||
get_permutations_stock_below_min = av.input_bool(form.is_out_of_stock.data, "is_out_of_stock", "Parameters_Product.from_form")
|
||||
print(f'form question: {type(form.is_out_of_stock)}\nbool interpretted: {get_permutations_stock_below_min}\type form: {type(form)}')
|
||||
Helper_App.console_log(f'form question: {type(form.is_out_of_stock)}\nbool interpretted: {get_permutations_stock_below_min}\type form: {type(form)}')
|
||||
return Parameters_Product(
|
||||
get_all_product_category = not has_category_filter,
|
||||
get_inactive_product_category = False,
|
||||
|
||||
@@ -21,6 +21,7 @@ from business_objects.store.discount import Discount
|
||||
from business_objects.store.stock_item import Stock_Item
|
||||
from business_objects.store.store_base import Store_Base
|
||||
from extensions import db
|
||||
from helpers.helper_app import Helper_App
|
||||
# external
|
||||
from pydantic import BaseModel
|
||||
from typing import ClassVar
|
||||
@@ -101,7 +102,7 @@ class Product_Category(SQLAlchemy_ABC, Store_Base):
|
||||
# self.product_index[Category.key_product_index_from_ids_product_permutation(product.id_product, product.id_permutation)] = len(self.products)
|
||||
try:
|
||||
self.get_index_product(product)
|
||||
print(f'category: {self}')
|
||||
Helper_App.console_log(f'category: {self}')
|
||||
raise ValueError(f"{av.error_msg_str(product, 'product', _m, Product)}\nProduct already in category.")
|
||||
except KeyError:
|
||||
self.product_index[product.id_product] = len(self.products)
|
||||
@@ -141,13 +142,13 @@ class Product_Category(SQLAlchemy_ABC, Store_Base):
|
||||
def get_all_product_variation_trees(self):
|
||||
for product in self.products:
|
||||
if product.has_variations:
|
||||
print(f'product with id:{product.id_product} has variations')
|
||||
Helper_App.console_log(f'product with id:{product.id_product} has variations')
|
||||
product.get_variation_trees()
|
||||
"""
|
||||
def index_product_from_ids_product_permutation(self, id_product, id_permutation):
|
||||
key = Category.key_product_index_from_ids_product_permutation(id_product, id_permutation)
|
||||
print(f'product_index: {self.product_index}')
|
||||
print(f'Key Error: {key}')
|
||||
Helper_App.console_log(f'product_index: {self.product_index}')
|
||||
Helper_App.console_log(f'Key Error: {key}')
|
||||
try:
|
||||
return self.product_index[key]
|
||||
except KeyError:
|
||||
@@ -167,7 +168,7 @@ class Product_Category(SQLAlchemy_ABC, Store_Base):
|
||||
"""
|
||||
def get_permutation_first(self):
|
||||
if not (len(self.products) == 0):
|
||||
print(f'getting first permutation from product')
|
||||
Helper_App.console_log(f'getting first permutation from product')
|
||||
return None if len(self.products) == 0 else self.products[0].get_permutation_selected()
|
||||
"""
|
||||
def is_available(self):
|
||||
@@ -204,7 +205,7 @@ class Product_Category(SQLAlchemy_ABC, Store_Base):
|
||||
}
|
||||
@classmethod
|
||||
def from_json(cls, json):
|
||||
print(f' Category.from_json: {json}')
|
||||
Helper_App.console_log(f' Category.from_json: {json}')
|
||||
category = cls()
|
||||
category.id_category = json[cls.ATTR_ID_PRODUCT_CATEGORY]
|
||||
category.code = json[cls.FLAG_CODE]
|
||||
@@ -382,9 +383,9 @@ class Product_Category_Container(Store_Base):
|
||||
return f'categories: {self.categories}'
|
||||
"""
|
||||
def get_permutation_first(self):
|
||||
print(f'getting first permutation from category list')
|
||||
Helper_App.console_log(f'getting first permutation from category list')
|
||||
if not (len(self.categories) == 0):
|
||||
print(f'getting first permutation from category')
|
||||
Helper_App.console_log(f'getting first permutation from category')
|
||||
return None if len(self.categories) == 0 else self.categories[0].get_permutation_first()
|
||||
"""
|
||||
def get_category_count(self):
|
||||
|
||||
@@ -25,6 +25,7 @@ from business_objects.store.product_variation import Product_Variation
|
||||
from business_objects.store.product_variation_tree import Product_Variation_Tree
|
||||
from business_objects.unit_measurement import Unit_Measurement
|
||||
from extensions import db
|
||||
from helpers.helper_app import Helper_App
|
||||
# external
|
||||
from datetime import datetime, timedelta
|
||||
import locale
|
||||
@@ -142,7 +143,7 @@ class Product_Permutation(db.Model, Store_Base):
|
||||
def from_DB_get_many_product_catalogue(cls, query_row):
|
||||
_m = f'{cls.__name__}.from_DB_get_many_product_catalogue'
|
||||
v_arg_type = 'class attribute'
|
||||
print(f'query_row: {query_row}')
|
||||
Helper_App.console_log(f'query_row: {query_row}')
|
||||
permutation = cls()
|
||||
permutation.id_permutation = query_row[0]
|
||||
permutation.id_product = query_row[1]
|
||||
@@ -469,7 +470,7 @@ class Product_Permutation(db.Model, Store_Base):
|
||||
Product_Permutation.FLAG_QUANTITY_MAX: self.quantity_max,
|
||||
Product_Permutation.FLAG_COST_LOCAL: f"<strong>{self.symbol_currency_cost}</strong>{self.cost_local}"
|
||||
}
|
||||
print('permutation row: ', a)
|
||||
Helper_App.console_log('permutation row: ', a)
|
||||
return a
|
||||
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ import lib.argument_validation as av
|
||||
from business_objects.store.store_base import Store_Base
|
||||
from business_objects.store.product_variation_type import Product_Variation_Type
|
||||
from extensions import db
|
||||
from helpers.helper_app import Helper_App
|
||||
# external
|
||||
from dataclasses import dataclass
|
||||
from typing import ClassVar
|
||||
@@ -201,7 +202,7 @@ class Product_Variation_Container(BaseModel):
|
||||
list_variations = []
|
||||
for variation in self.variations:
|
||||
list_variations.append(variation.to_json_option())
|
||||
print(f'list_variations: {list_variations}')
|
||||
Helper_App.console_log(f'list_variations: {list_variations}')
|
||||
return list_variations
|
||||
def to_list_variation_type_options(self):
|
||||
list_variation_types = []
|
||||
|
||||
@@ -13,6 +13,7 @@ Business object for product
|
||||
# internal
|
||||
from business_objects.store.product_variation import Product_Variation
|
||||
from extensions import db
|
||||
from helpers.helper_app import Helper_App
|
||||
# external
|
||||
|
||||
|
||||
@@ -133,16 +134,16 @@ class Product_Variation_Tree():
|
||||
variations.append(node.variation)
|
||||
return variations
|
||||
def to_preview_str(self):
|
||||
print(f'Product_Variation_Tree.to_preview_str')
|
||||
Helper_App.console_log(f'Product_Variation_Tree.to_preview_str')
|
||||
variations = self.get_product_variations()
|
||||
print(f'variations: {variations}')
|
||||
Helper_App.console_log(f'variations: {variations}')
|
||||
preview_str = ''
|
||||
for variation in variations:
|
||||
is_first = (preview_str == '')
|
||||
preview_str += f'{variation.variation_type.name_singular}: {variation.name}'
|
||||
if is_first:
|
||||
preview_str += '\n'
|
||||
print(f'preview_str: {preview_str}')
|
||||
Helper_App.console_log(f'preview_str: {preview_str}')
|
||||
return preview_str
|
||||
def to_json(self):
|
||||
variations = self.get_product_variations()
|
||||
@@ -179,7 +180,7 @@ class Product_Variation_Container(BaseModel):
|
||||
list_variations = []
|
||||
for variation in self.variations:
|
||||
list_variations.append(variation.to_json_option())
|
||||
print(f'list_variations: {list_variations}')
|
||||
Helper_App.console_log(f'list_variations: {list_variations}')
|
||||
return list_variations
|
||||
def to_list_variation_type_options(self):
|
||||
list_variation_types = []
|
||||
|
||||
@@ -19,6 +19,7 @@ from business_objects.store.product_variation_tree import Product_Variation_Tree
|
||||
from business_objects.store.storage_location import Storage_Location
|
||||
from business_objects.store.store_base import Store_Base
|
||||
from extensions import db
|
||||
from helpers.helper_app import Helper_App
|
||||
# external
|
||||
from dataclasses import dataclass
|
||||
from typing import ClassVar, Optional
|
||||
@@ -106,7 +107,7 @@ class Stock_Item(db.Model, Store_Base):
|
||||
stock_item.id_permutation = json.get(cls.ATTR_ID_PRODUCT_PERMUTATION, 0)
|
||||
stock_item.id_product = json[cls.ATTR_ID_PRODUCT]
|
||||
stock_item.id_category = json[cls.ATTR_ID_PRODUCT_CATEGORY]
|
||||
print(f'json: {json}\nhalf stock item: {stock_item}')
|
||||
Helper_App.console_log(f'json: {json}\nhalf stock item: {stock_item}')
|
||||
stock_item.variation_tree = Product_Variation_Tree.from_json_str(json[cls.FLAG_PRODUCT_VARIATIONS])
|
||||
stock_item.date_purchased = json[cls.FLAG_DATE_PURCHASED]
|
||||
stock_item.date_received = json[cls.FLAG_DATE_RECEIVED]
|
||||
|
||||
@@ -15,6 +15,7 @@ import lib.argument_validation as av
|
||||
from business_objects.store.plant import Plant
|
||||
from business_objects.store.store_base import Store_Base
|
||||
from extensions import db
|
||||
from helpers.helper_app import Helper_App
|
||||
# external
|
||||
from typing import ClassVar
|
||||
|
||||
@@ -74,7 +75,7 @@ class Storage_Location(db.Model, Store_Base):
|
||||
}
|
||||
@classmethod
|
||||
def from_json(cls, json):
|
||||
print(f'{cls.__name__}.from_json: {json}')
|
||||
Helper_App.console_log(f'{cls.__name__}.from_json: {json}')
|
||||
location = cls()
|
||||
location.id_location = json[cls.ATTR_ID_STORAGE_LOCATION],
|
||||
location.id_plant = json[cls.ATTR_ID_PLANT],
|
||||
|
||||
@@ -15,7 +15,7 @@ import lib.argument_validation as av
|
||||
from lib import data_types
|
||||
from forms.forms import Form_Basket_Add, Form_Basket_Edit # Form_Product
|
||||
from extensions import db
|
||||
|
||||
from helpers.helper_app import Helper_App
|
||||
# external
|
||||
from datetime import datetime, timedelta
|
||||
import locale
|
||||
@@ -61,7 +61,7 @@ class Stripe_Product(db.Model):
|
||||
av.val_str(id_stripe_product, 'id_stripe_product', _m, max_len=100, v_arg_type=v_arg_type)
|
||||
av.val_str(id_stripe_price, 'id_stripe_price', _m, max_len=100, v_arg_type=v_arg_type)
|
||||
av.full_val_bool(is_subscription, 'is_subscription', _m, v_arg_type=v_arg_type)
|
||||
print(f'is_subscription: {is_subscription}, {av.input_bool(is_subscription, "is_subscription", _m, v_arg_type=v_arg_type)}')
|
||||
Helper_App.console_log(f'is_subscription: {is_subscription}, {av.input_bool(is_subscription, "is_subscription", _m, v_arg_type=v_arg_type)}')
|
||||
is_subscription = av.input_bool(is_subscription, "is_subscription", _m, v_arg_type=v_arg_type)
|
||||
if is_subscription:
|
||||
av.val_str(name_recurring_interval, 'name_recurring_interval', _m, max_len=255, v_arg_type=v_arg_type)
|
||||
|
||||
@@ -17,6 +17,7 @@ from business_objects.currency import Currency
|
||||
from business_objects.db_base import Get_Many_Parameters_Base
|
||||
from business_objects.store.store_base import Store_Base
|
||||
from extensions import db
|
||||
from helpers.helper_app import Helper_App
|
||||
# external
|
||||
from pydantic import BaseModel
|
||||
from typing import ClassVar
|
||||
@@ -106,7 +107,7 @@ addresses: {self.addresses}
|
||||
}
|
||||
@classmethod
|
||||
def from_json(cls, json):
|
||||
print(f'{cls.__name__}.from_json: {json}')
|
||||
Helper_App.console_log(f'{cls.__name__}.from_json: {json}')
|
||||
supplier = cls()
|
||||
supplier.id_supplier = json[cls.ATTR_ID_SUPPLIER]
|
||||
supplier.id_currency = json[cls.ATTR_ID_CURRENCY]
|
||||
|
||||
@@ -15,6 +15,7 @@ import lib.argument_validation as av
|
||||
from business_objects.store.store_base import Store_Base
|
||||
from business_objects.region import Region
|
||||
from extensions import db
|
||||
from helpers.helper_app import Helper_App
|
||||
# external
|
||||
from typing import ClassVar
|
||||
from flask import jsonify
|
||||
@@ -71,7 +72,7 @@ class Supplier_Address(db.Model, Store_Base):
|
||||
{self.FLAG_ACTIVE}: {self.active}
|
||||
'''
|
||||
def to_json(self):
|
||||
print(f'{self.__class__.__name__}.to_json\n{self.__dict__}\n{self}')
|
||||
Helper_App.console_log(f'{self.__class__.__name__}.to_json\n{self.__dict__}\n{self}')
|
||||
return {
|
||||
**self.get_shared_json_attributes(self),
|
||||
self.ATTR_ID_ADDRESS: self.id_address,
|
||||
@@ -88,7 +89,7 @@ class Supplier_Address(db.Model, Store_Base):
|
||||
return jsonify(self.to_json())
|
||||
@classmethod
|
||||
def from_json(cls, json):
|
||||
print(f'{cls.__name__}.from_json: {json}')
|
||||
Helper_App.console_log(f'{cls.__name__}.from_json: {json}')
|
||||
address = cls()
|
||||
address.id_address = json[cls.ATTR_ID_ADDRESS]
|
||||
address.id_supplier = json[cls.ATTR_ID_SUPPLIER]
|
||||
|
||||
@@ -17,6 +17,7 @@ from business_objects.db_base import Get_Many_Parameters_Base
|
||||
from business_objects.store.store_base import Store_Base
|
||||
from business_objects.store.supplier import Supplier
|
||||
from extensions import db
|
||||
from helpers.helper_app import Helper_App
|
||||
# external
|
||||
from pydantic import BaseModel
|
||||
from typing import ClassVar, Optional
|
||||
@@ -92,7 +93,7 @@ class Supplier_Purchase_Order(db.Model, Store_Base):
|
||||
}
|
||||
@classmethod
|
||||
def from_json(cls, json):
|
||||
print(f'{cls.__name__}.from_json: {json}')
|
||||
Helper_App.console_log(f'{cls.__name__}.from_json: {json}')
|
||||
supplier_purchase_order = cls()
|
||||
supplier_purchase_order.id_order = json[cls.ATTR_ID_SUPPLIER_PURCHASE_ORDER]
|
||||
supplier_purchase_order.id_supplier = json[cls.ATTR_ID_SUPPLIER]
|
||||
@@ -197,7 +198,7 @@ class Supplier_Purchase_Order_Product_Link(db.Model, Store_Base):
|
||||
}
|
||||
@classmethod
|
||||
def from_json(cls, json):
|
||||
print(f'{cls.__name__}.from_json: {json}')
|
||||
Helper_App.console_log(f'{cls.__name__}.from_json: {json}')
|
||||
link = cls()
|
||||
link.id_link = json[cls.ATTR_ID_SUPPLIER_PURCHASE_ORDER_PRODUCT_LINK]
|
||||
link.id_order = json[cls.ATTR_ID_SUPPLIER_PURCHASE_ORDER]
|
||||
|
||||
@@ -12,6 +12,7 @@ from business_objects.base import Base
|
||||
from business_objects.db_base import SQLAlchemy_ABC, Get_Many_Parameters_Base
|
||||
from extensions import db
|
||||
# from forms.forms import Form_Filters_User
|
||||
from helpers.helper_app import Helper_App
|
||||
import lib.argument_validation as av
|
||||
# external
|
||||
from dataclasses import dataclass
|
||||
@@ -78,7 +79,7 @@ class Unit_Measurement(SQLAlchemy_ABC, Base):
|
||||
}
|
||||
@classmethod
|
||||
def from_json(cls, json):
|
||||
print(f' Unit_Measurement.from_json: {json}')
|
||||
Helper_App.console_log(f' Unit_Measurement.from_json: {json}')
|
||||
unit = cls()
|
||||
unit.id_unit_measurement = json[cls.ATTR_ID_UNIT_MEASUREMENT]
|
||||
unit.name_singular = json[cls.FLAG_NAME_SINGULAR]
|
||||
|
||||
@@ -12,6 +12,7 @@ from business_objects.base import Base
|
||||
import lib.argument_validation as av
|
||||
from forms.forms import Form_Filters_User
|
||||
from extensions import db
|
||||
from helpers.helper_app import Helper_App
|
||||
# external
|
||||
from dataclasses import dataclass
|
||||
from typing import ClassVar
|
||||
@@ -64,7 +65,7 @@ class User(db.Model, Base):
|
||||
_m = 'User.from_json'
|
||||
user = User()
|
||||
if json is None: return user
|
||||
print(f'{_m}\njson: {json}')
|
||||
Helper_App.console_log(f'{_m}\njson: {json}')
|
||||
user.id_user = json['id_user']
|
||||
user.id_user_auth0 = json['id_user_auth0']
|
||||
user.firstname = json['firstname']
|
||||
@@ -78,16 +79,16 @@ class User(db.Model, Base):
|
||||
user.can_admin_store = av.input_bool(json['can_admin_store'], 'can_admin_store', _m)
|
||||
user.can_admin_user = av.input_bool(json['can_admin_user'], 'can_admin_user', _m)
|
||||
user.is_logged_in = (user.id_user_auth0 is not None)
|
||||
print(f'user: {user}')
|
||||
Helper_App.console_log(f'user: {user}')
|
||||
return user
|
||||
|
||||
# print(f'user: {user}')
|
||||
# Helper_App.console_log(f'user: {user}')
|
||||
@staticmethod
|
||||
def from_json_auth0(json):
|
||||
_m = 'User.from_json_auth0'
|
||||
user = User()
|
||||
if json is None: return user
|
||||
print(f'{_m}\njson: {json}')
|
||||
Helper_App.console_log(f'{_m}\njson: {json}')
|
||||
user_info = json['userinfo']
|
||||
user.id_user = None
|
||||
user.id_user_auth0 = user_info['sub']
|
||||
@@ -102,7 +103,7 @@ class User(db.Model, Base):
|
||||
user.can_admin_store = None
|
||||
user.can_admin_user = None
|
||||
user.is_logged_in = (user.id_user_auth0 is not None and user.id_user_auth0 != '')
|
||||
print(f'user: {user}')
|
||||
Helper_App.console_log(f'user: {user}')
|
||||
return user
|
||||
|
||||
def to_json(self):
|
||||
@@ -120,7 +121,7 @@ class User(db.Model, Base):
|
||||
'can_admin_store': self.can_admin_store,
|
||||
'can_admin_user': self.can_admin_user
|
||||
}
|
||||
print(f'as_json: {as_json}')
|
||||
Helper_App.console_log(f'as_json: {as_json}')
|
||||
return as_json
|
||||
|
||||
def __repr__(self):
|
||||
|
||||
@@ -11,6 +11,7 @@ Configuration variables
|
||||
"""
|
||||
|
||||
# IMPORTS
|
||||
from lib import argument_validation as av
|
||||
import os
|
||||
from dotenv import load_dotenv, find_dotenv
|
||||
|
||||
@@ -19,7 +20,7 @@ load_dotenv(find_dotenv())
|
||||
# CLASSES
|
||||
class Config:
|
||||
# Miscellaneous
|
||||
DEBUG = False
|
||||
DEBUG = av.input_bool(os.getenv('DEBUG'), 'DEBUG', 'Config')
|
||||
TESTING = False
|
||||
URL_HOST = os.getenv('URL_HOST')
|
||||
SECRET_KEY = os.getenv('KEY_SECRET_FLASK') # gen cmd: openssl rand -hex 32
|
||||
@@ -52,7 +53,7 @@ class Config:
|
||||
# id_currency = 1
|
||||
# id_region_delivery = 1
|
||||
# Mail
|
||||
MAIL_DEBUG = True
|
||||
MAIL_DEBUG = av.input_bool(os.getenv('DEBUG'), 'DEBUG', 'Config')
|
||||
MAIL_SERVER = 'mail.partsltd.co.uk' # 'smtp.gmail.com'
|
||||
MAIL_PORT = 465 # 587
|
||||
MAIL_USE_TLS = False
|
||||
@@ -83,7 +84,6 @@ elif config_env == 'production':
|
||||
else:
|
||||
raise ValueError("Invalid configuration environment")
|
||||
|
||||
# print(f'config: {app_config}\nid auth0 client: {app_config.ID_AUTH0_CLIENT}')
|
||||
|
||||
# environment variables
|
||||
"""
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -47,7 +47,7 @@ def contact():
|
||||
user = DataStore_Base.get_user_session()
|
||||
form = Form_Contact()
|
||||
form.email.data = user.email
|
||||
form.name.data = user.firstname + (' ' if user.firstname and user.surname else '') + user.surname
|
||||
form.name.data = (user.firstname if user.firstname else '') + (' ' if user.firstname and user.surname else '') + (user.surname if user.surname else '')
|
||||
model = Model_View_Contact(form)
|
||||
html_body = render_template('pages/core/_contact.html', model = model)
|
||||
except Exception as e:
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -30,13 +30,13 @@ routes_store_manufacturing_purchase_order = Blueprint('routes_store_manufacturin
|
||||
|
||||
@routes_store_manufacturing_purchase_order.route(Model_View_Store_Manufacturing_Purchase_Order.HASH_PAGE_STORE_MANUFACTURING_PURCHASE_ORDERS, methods=['GET'])
|
||||
def manufacturing_purchase_orders():
|
||||
print('manufacturing_purchase_orders')
|
||||
Helper_App.console_log('manufacturing_purchase_orders')
|
||||
try:
|
||||
form_filters = Filters_Manufacturing_Purchase_Order.from_json(request.args)
|
||||
except Exception as e:
|
||||
print(f'Error: {e}')
|
||||
Helper_App.console_log(f'Error: {e}')
|
||||
form_filters = Filters_Manufacturing_Purchase_Order()
|
||||
print(f'form_filters={form_filters}')
|
||||
Helper_App.console_log(f'form_filters={form_filters}')
|
||||
model = Model_View_Store_Manufacturing_Purchase_Order(form_filters)
|
||||
if not model.is_user_logged_in:
|
||||
return redirect(url_for('routes_core.home'))
|
||||
@@ -80,7 +80,7 @@ def save_manufacturing_purchase_order():
|
||||
data = Helper_App.get_request_data(request)
|
||||
try:
|
||||
form_filters = Filters_Manufacturing_Purchase_Order.from_json(data[Model_View_Store_Manufacturing_Purchase_Order.FLAG_FORM_FILTERS])
|
||||
print(f'form_filters: {form_filters}')
|
||||
Helper_App.console_log(f'form_filters: {form_filters}')
|
||||
|
||||
manufacturing_purchase_orders = data[Model_View_Store_Manufacturing_Purchase_Order.FLAG_MANUFACTURING_PURCHASE_ORDER]
|
||||
if len(manufacturing_purchase_orders) == 0:
|
||||
@@ -88,11 +88,11 @@ def save_manufacturing_purchase_order():
|
||||
Model_View_Store_Manufacturing_Purchase_Order.FLAG_STATUS: Model_View_Store_Manufacturing_Purchase_Order.FLAG_FAILURE,
|
||||
Model_View_Store_Manufacturing_Purchase_Order.FLAG_MESSAGE: f'No stock items.'
|
||||
})
|
||||
print(f'manufacturing_purchase_orders={manufacturing_purchase_orders}')
|
||||
Helper_App.console_log(f'manufacturing_purchase_orders={manufacturing_purchase_orders}')
|
||||
objs_manufacturing_purchase_order = []
|
||||
for manufacturing_purchase_order in manufacturing_purchase_orders:
|
||||
objs_manufacturing_purchase_order.append(Manufacturing_Purchase_Order.from_json(manufacturing_purchase_order))
|
||||
print(f'objs_manufacturing_purchase_order={objs_manufacturing_purchase_order}')
|
||||
Helper_App.console_log(f'objs_manufacturing_purchase_order={objs_manufacturing_purchase_order}')
|
||||
save_errors = Model_View_Store_Manufacturing_Purchase_Order.save_manufacturing_purchase_orders(data.get('comment', 'No comment'), objs_manufacturing_purchase_order)
|
||||
if len(save_errors) > 0:
|
||||
return jsonify({
|
||||
|
||||
@@ -11,10 +11,7 @@ Initializes the Flask application, sets the configuration based on the environme
|
||||
"""
|
||||
|
||||
# IMPORTS
|
||||
# VARIABLE INSTANTIATION
|
||||
# METHODS
|
||||
|
||||
# IMPORTS
|
||||
from helpers.helper_app import Helper_App
|
||||
import os
|
||||
import stripe
|
||||
import json
|
||||
@@ -28,7 +25,7 @@ key_public = os.environ.get("KEY_PUBLIC_STRIPE") # 'pk_test_51OGrxlL7BuLKjoMpfpf
|
||||
|
||||
# METHODS
|
||||
def create_product_price():
|
||||
print(f'stripe.api_key = {stripe.api_key}')
|
||||
Helper_App.console_log(f'stripe.api_key = {stripe.api_key}')
|
||||
starter_subscription = stripe.Product.create(
|
||||
name="Starter Subscription",
|
||||
description="$12/Month subscription",
|
||||
@@ -42,8 +39,8 @@ def create_product_price():
|
||||
)
|
||||
|
||||
# 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}")
|
||||
Helper_App.console_log(f"Success! Here is your starter subscription product id: {starter_subscription.id}")
|
||||
Helper_App.console_log(f"Success! Here is your starter subscription price id: {starter_subscription_price.id}")
|
||||
|
||||
return starter_subscription_price.id
|
||||
|
||||
@@ -54,7 +51,7 @@ def get_file_str(f_address):
|
||||
# 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.')
|
||||
Helper_App.console_log('You must set a Price ID in .env. Please see the README.')
|
||||
exit(0)
|
||||
|
||||
# For sample support and debugging, not required for production:
|
||||
@@ -152,10 +149,10 @@ def webhook_received():
|
||||
event_type = request_data['type']
|
||||
data_object = data['object']
|
||||
|
||||
print('event ' + event_type)
|
||||
Helper_App.console_log('event ' + event_type)
|
||||
|
||||
if event_type == 'checkout.session.completed':
|
||||
print('🔔 Payment succeeded!')
|
||||
Helper_App.console_log('🔔 Payment succeeded!')
|
||||
|
||||
return jsonify({Model_View_Base.FLAG_STATUS: Model_View_Base.FLAG_SUCCESS})
|
||||
|
||||
|
||||
@@ -31,21 +31,21 @@ routes_store_product = Blueprint('routes_store_product', __name__)
|
||||
"""
|
||||
@routes_store_product.route(Model_View_Store_Product.HASH_PAGE_STORE_PRODUCTS, methods=['GET'])
|
||||
def products():
|
||||
print('products')
|
||||
print(f'request.args={request.args}')
|
||||
Helper_App.console_log('products')
|
||||
Helper_App.console_log(f'request.args={request.args}')
|
||||
user = DataStore_Store_Product.get_user_session()
|
||||
filters = Parameters_Product.get_default(user.id_user)
|
||||
have_changed_filters = False
|
||||
arg_filter_is_not_empty = request.args.get(Model_View_Store_Product.FLAG_IS_NOT_EMPTY, None)
|
||||
have_changed_filters = have_changed_filters or arg_filter_is_not_empty is None
|
||||
print(f'arg_filter_is_not_empty={arg_filter_is_not_empty}')
|
||||
Helper_App.console_log(f'arg_filter_is_not_empty={arg_filter_is_not_empty}')
|
||||
filters.is_not_empty = filters.is_not_empty if arg_filter_is_not_empty is None else av.input_bool(arg_filter_is_not_empty, 'is_not_empty', 'filter')
|
||||
arg_filter_active = request.args.get(Model_View_Store_Product.FLAG_ACTIVE, None)
|
||||
have_changed_filters = have_changed_filters or arg_filter_active is None
|
||||
print(f'arg_filter_active={arg_filter_active}')
|
||||
Helper_App.console_log(f'arg_filter_active={arg_filter_active}')
|
||||
filters.active = filters.active if arg_filter_active is None else av.input_bool(arg_filter_active, 'active', 'filter')
|
||||
if have_changed_filters:
|
||||
print('redirecting')
|
||||
Helper_App.console_log('redirecting')
|
||||
return redirect(url_for('routes_store_product.products', **filters.to_json()))
|
||||
model = Model_View_Store_Product(filters)
|
||||
return render_template('pages/store/_products.html', model = model)
|
||||
@@ -76,7 +76,7 @@ def get_Filters_Product(data_request):
|
||||
def save():
|
||||
data = Helper_App.get_request_data(request)
|
||||
# form_filters = None
|
||||
print(f'data={data}')
|
||||
Helper_App.console_log(f'data={data}')
|
||||
try:
|
||||
form_filters = get_Filters_Product(data)
|
||||
if not form_filters.validate_on_submit():
|
||||
@@ -90,11 +90,11 @@ def save():
|
||||
for category in categories:
|
||||
objsCategory.append(Product.from_json(category))
|
||||
# model_save = Model_View_Store_Product() # filters_product=filters_form)
|
||||
print(f'objsCategory={objsCategory}')
|
||||
Helper_App.console_log(f'objsCategory={objsCategory}')
|
||||
Model_View_Store_Product.save_categories(data.get('comment', 'No comment'), objsCategory)
|
||||
|
||||
model_return = Model_View_Store_Product(filters=filters_form)
|
||||
print('nips')
|
||||
Helper_App.console_log('nips')
|
||||
return jsonify({Model_View_Store_Product.FLAG_STATUS: Model_View_Store_Product.FLAG_SUCCESS, 'Success': True, Model_View_Store_Product.FLAG_DATA: model_return.category_list.to_json()})
|
||||
except Exception as e:
|
||||
return jsonify({Model_View_Store_Product.FLAG_STATUS: Model_View_Store_Product.FLAG_FAILURE, Model_View_Store_Product.FLAG_MESSAGE: f'Bad data received by controller.\n{e}'})
|
||||
@@ -103,13 +103,13 @@ def save():
|
||||
|
||||
@routes_store_product.route(Model_View_Store_Product.HASH_PAGE_STORE_PRODUCTS, methods=['GET'])
|
||||
def products():
|
||||
print('products')
|
||||
Helper_App.console_log('products')
|
||||
try:
|
||||
form_filters = Filters_Product.from_json(request.args)
|
||||
except Exception as e:
|
||||
print(f'Error: {e}')
|
||||
Helper_App.console_log(f'Error: {e}')
|
||||
form_filters = Filters_Product()
|
||||
print(f'form_filters={form_filters}')
|
||||
Helper_App.console_log(f'form_filters={form_filters}')
|
||||
model = Model_View_Store_Product(form_filters)
|
||||
if not model.is_user_logged_in:
|
||||
# return redirect(url_for('routes_user.login', data = jsonify({ Model_View_Store_Product.FLAG_CALLBACK: Model_View_Store_Product.HASH_PAGE_STORE_PRODUCTS })))
|
||||
@@ -150,7 +150,7 @@ def save_product():
|
||||
Model_View_Store_Product.FLAG_MESSAGE: f'Filters form invalid.\n{form_filters.errors}'
|
||||
})
|
||||
# filters_form = Filters_Product.from_form(form_filters)
|
||||
print(f'form_filters: {form_filters}')
|
||||
Helper_App.console_log(f'form_filters: {form_filters}')
|
||||
|
||||
products = data[Model_View_Store_Product.FLAG_PRODUCT]
|
||||
if len(products) == 0:
|
||||
@@ -162,13 +162,13 @@ def save_product():
|
||||
for product in products:
|
||||
objsProduct.append(Product.from_json(product))
|
||||
# model_save = Model_View_Store_Product() # filters_product=filters_form)
|
||||
print(f'objsProduct={objsProduct}')
|
||||
Helper_App.console_log(f'objsProduct={objsProduct}')
|
||||
save_errors = Model_View_Store_Product.save_products(data.get('comment', 'No comment'), objsProduct)
|
||||
|
||||
model_return = Model_View_Store_Product(form_filters=form_filters)
|
||||
if not model_return.is_user_logged_in:
|
||||
raise Exception('User not logged in')
|
||||
print('nips')
|
||||
Helper_App.console_log('nips')
|
||||
return jsonify({
|
||||
Model_View_Store_Product.FLAG_STATUS: Model_View_Store_Product.FLAG_SUCCESS,
|
||||
Model_View_Store_Product.FLAG_DATA: model_return.category_list.to_json()
|
||||
|
||||
@@ -30,27 +30,27 @@ routes_store_product_category = Blueprint('routes_store_product_category', __nam
|
||||
|
||||
@routes_store_product_category.route(Model_View_Store_Product_Category.HASH_PAGE_STORE_PRODUCT_CATEGORIES, methods=['GET'])
|
||||
def categories():
|
||||
print('categories')
|
||||
Helper_App.console_log('categories')
|
||||
# data = Helper_App.get_request_data(request)
|
||||
try:
|
||||
form_filters = Filters_Product_Category.from_json(request.args)
|
||||
except Exception as e:
|
||||
print(f'Error: {e}')
|
||||
Helper_App.console_log(f'Error: {e}')
|
||||
form_filters = Filters_Product_Category()
|
||||
print(f'form_filters={form_filters}')
|
||||
Helper_App.console_log(f'form_filters={form_filters}')
|
||||
"""
|
||||
filters = Filters_Product_Category.get_default()
|
||||
have_changed_filters = False
|
||||
arg_filter_is_not_empty = request.args.get(Model_View_Store_Product_Category.FLAG_IS_NOT_EMPTY, None)
|
||||
have_changed_filters = have_changed_filters or arg_filter_is_not_empty is None
|
||||
print(f'arg_filter_is_not_empty={arg_filter_is_not_empty}')
|
||||
Helper_App.console_log(f'arg_filter_is_not_empty={arg_filter_is_not_empty}')
|
||||
filters.is_not_empty = filters.is_not_empty if arg_filter_is_not_empty is None else av.input_bool(arg_filter_is_not_empty, 'is_not_empty', 'filter_category')
|
||||
arg_filter_active = request.args.get(Model_View_Store_Product_Category.FLAG_ACTIVE, None)
|
||||
have_changed_filters = have_changed_filters or arg_filter_active is None
|
||||
print(f'arg_filter_active={arg_filter_active}')
|
||||
Helper_App.console_log(f'arg_filter_active={arg_filter_active}')
|
||||
filters.active = filters.active if arg_filter_active is None else av.input_bool(arg_filter_active, 'active', 'filter_category')
|
||||
if have_changed_filters:
|
||||
print('redirecting')
|
||||
Helper_App.console_log('redirecting')
|
||||
return redirect(url_for('routes_store_product_category.categories', **filters.to_json()))
|
||||
"""
|
||||
model = Model_View_Store_Product_Category(form_filters)
|
||||
@@ -107,7 +107,7 @@ def save_category():
|
||||
for category in categories:
|
||||
objsCategory.append(Product_Category.from_json(category))
|
||||
# model_save = Model_View_Store_Product_Category() # filters_product=filters_form)
|
||||
print(f'objsCategory={objsCategory}')
|
||||
Helper_App.console_log(f'objsCategory={objsCategory}')
|
||||
Model_View_Store_Product_Category.save_categories(data.get('comment', 'No comment'), objsCategory)
|
||||
|
||||
model_return = Model_View_Store_Product_Category(form_filters=form_filters)
|
||||
|
||||
@@ -88,13 +88,13 @@ def permutation_save():
|
||||
|
||||
@routes_store_product_permutation.route(Model_View_Store_Product_Permutation.HASH_PAGE_STORE_PRODUCT_PERMUTATIONS, methods=['GET'])
|
||||
def permutations():
|
||||
print('permutations')
|
||||
Helper_App.console_log('permutations')
|
||||
try:
|
||||
form_filters = Filters_Product_Permutation.from_json(request.args)
|
||||
except Exception as e:
|
||||
print(f'Error: {e}')
|
||||
Helper_App.console_log(f'Error: {e}')
|
||||
form_filters = Filters_Product_Permutation()
|
||||
print(f'form_filters={form_filters}')
|
||||
Helper_App.console_log(f'form_filters={form_filters}')
|
||||
model = Model_View_Store_Product_Permutation(form_filters)
|
||||
if not model.is_user_logged_in:
|
||||
# return redirect(url_for('routes_user.login', data = jsonify({ Model_View_Store_Product_Permutation.FLAG_CALLBACK: Model_View_Store_Product_Permutation.HASH_PAGE_STORE_PRODUCT_PERMUTATIONS })))
|
||||
@@ -135,7 +135,7 @@ def save_permutation():
|
||||
Model_View_Store_Product_Permutation.FLAG_MESSAGE: f'Filters form invalid.\n{form_filters.errors}'
|
||||
})
|
||||
# filters_form = Filters_Product_Permutation.from_form(form_filters)
|
||||
print(f'form_filters: {form_filters}')
|
||||
Helper_App.console_log(f'form_filters: {form_filters}')
|
||||
|
||||
permutations = data[Model_View_Store_Product_Permutation.FLAG_PRODUCT_PERMUTATION]
|
||||
if len(permutations) == 0:
|
||||
@@ -147,13 +147,13 @@ def save_permutation():
|
||||
for permutation in permutations:
|
||||
objsPermutation.append(Product_Permutation.from_json(permutation))
|
||||
# model_save = Model_View_Store_Product_Permutation() # filters_product=filters_form)
|
||||
print(f'objsPermutation={objsPermutation}')
|
||||
Helper_App.console_log(f'objsPermutation={objsPermutation}')
|
||||
Model_View_Store_Product_Permutation.save_permutations(data.get('comment', 'No comment'), objsPermutation)
|
||||
|
||||
model_return = Model_View_Store_Product_Permutation(form_filters=form_filters)
|
||||
if not model_return.is_user_logged_in:
|
||||
raise Exception('User not logged in')
|
||||
print('nips')
|
||||
Helper_App.console_log('nips')
|
||||
return jsonify({
|
||||
Model_View_Store_Product_Permutation.FLAG_STATUS: Model_View_Store_Product_Permutation.FLAG_SUCCESS,
|
||||
Model_View_Store_Product_Permutation.FLAG_DATA: model_return.category_list.to_json()
|
||||
|
||||
@@ -30,13 +30,13 @@ routes_store_stock_item = Blueprint('routes_store_stock_item', __name__)
|
||||
|
||||
@routes_store_stock_item.route(Model_View_Store_Stock_Item.HASH_PAGE_STORE_STOCK_ITEMS, methods=['GET'])
|
||||
def stock_items():
|
||||
print('stock_items')
|
||||
Helper_App.console_log('stock_items')
|
||||
try:
|
||||
form_filters = Filters_Stock_Item.from_json(request.args)
|
||||
except Exception as e:
|
||||
print(f'Error: {e}')
|
||||
Helper_App.console_log(f'Error: {e}')
|
||||
form_filters = Filters_Stock_Item()
|
||||
print(f'form_filters={form_filters}')
|
||||
Helper_App.console_log(f'form_filters={form_filters}')
|
||||
model = Model_View_Store_Stock_Item(form_filters)
|
||||
if not model.is_user_logged_in:
|
||||
# return redirect(url_for('routes_user.login', data = jsonify({ Model_View_Store_Stock_Item.FLAG_CALLBACK: Model_View_Store_Stock_Item.HASH_PAGE_STORE_STOCK_ITEMS })))
|
||||
@@ -108,7 +108,7 @@ def save_stock_item():
|
||||
})
|
||||
"""
|
||||
# filters_form = Filters_Stock_Item.from_form(form_filters)
|
||||
print(f'form_filters: {form_filters}')
|
||||
Helper_App.console_log(f'form_filters: {form_filters}')
|
||||
|
||||
stock_items = data[Model_View_Store_Stock_Item.FLAG_STOCK_ITEM]
|
||||
if len(stock_items) == 0:
|
||||
@@ -116,12 +116,12 @@ def save_stock_item():
|
||||
Model_View_Store_Stock_Item.FLAG_STATUS: Model_View_Store_Stock_Item.FLAG_FAILURE,
|
||||
Model_View_Store_Stock_Item.FLAG_MESSAGE: f'No stock items.'
|
||||
})
|
||||
print(f'stock_items={stock_items}')
|
||||
Helper_App.console_log(f'stock_items={stock_items}')
|
||||
objs_stock_item = []
|
||||
for stock_item in stock_items:
|
||||
objs_stock_item.append(Stock_Item.from_json(stock_item))
|
||||
# model_save = Model_View_Store_Stock_Item() # filters_product=filters_form)
|
||||
print(f'objs_stock_item={objs_stock_item}')
|
||||
Helper_App.console_log(f'objs_stock_item={objs_stock_item}')
|
||||
save_errors = Model_View_Store_Stock_Item.save_stock_items(data.get('comment', 'No comment'), objs_stock_item)
|
||||
if len(save_errors) > 0:
|
||||
return jsonify({
|
||||
|
||||
@@ -30,13 +30,13 @@ routes_store_supplier = Blueprint('routes_store_supplier', __name__)
|
||||
|
||||
@routes_store_supplier.route(Model_View_Store_Supplier.HASH_PAGE_STORE_SUPPLIERS, methods=['GET'])
|
||||
def suppliers():
|
||||
print('suppliers')
|
||||
Helper_App.console_log('suppliers')
|
||||
try:
|
||||
form_filters = Filters_Supplier.from_json(request.args)
|
||||
except Exception as e:
|
||||
print(f'Error: {e}')
|
||||
Helper_App.console_log(f'Error: {e}')
|
||||
form_filters = Filters_Supplier()
|
||||
print(f'form_filters={form_filters}')
|
||||
Helper_App.console_log(f'form_filters={form_filters}')
|
||||
model = Model_View_Store_Supplier(form_filters)
|
||||
if not model.is_user_logged_in:
|
||||
return redirect(url_for('routes_core.home'))
|
||||
@@ -80,7 +80,7 @@ def save_supplier():
|
||||
data = Helper_App.get_request_data(request)
|
||||
try:
|
||||
form_filters = Filters_Supplier.from_json(data[Model_View_Store_Supplier.FLAG_FORM_FILTERS])
|
||||
print(f'form_filters: {form_filters}')
|
||||
Helper_App.console_log(f'form_filters: {form_filters}')
|
||||
|
||||
suppliers = data[Model_View_Store_Supplier.FLAG_SUPPLIER]
|
||||
if len(suppliers) == 0:
|
||||
@@ -88,11 +88,11 @@ def save_supplier():
|
||||
Model_View_Store_Supplier.FLAG_STATUS: Model_View_Store_Supplier.FLAG_FAILURE,
|
||||
Model_View_Store_Supplier.FLAG_MESSAGE: f'No stock items.'
|
||||
})
|
||||
print(f'suppliers={suppliers}')
|
||||
Helper_App.console_log(f'suppliers={suppliers}')
|
||||
objs_supplier = []
|
||||
for supplier in suppliers:
|
||||
objs_supplier.append(Supplier.from_json(supplier))
|
||||
print(f'objs_supplier={objs_supplier}')
|
||||
Helper_App.console_log(f'objs_supplier={objs_supplier}')
|
||||
|
||||
save_errors = Model_View_Store_Supplier.save_suppliers(data.get('comment', 'No comment'), objs_supplier)
|
||||
if len(save_errors) > 0:
|
||||
|
||||
@@ -30,13 +30,13 @@ routes_store_supplier_purchase_order = Blueprint('routes_store_supplier_purchase
|
||||
|
||||
@routes_store_supplier_purchase_order.route(Model_View_Store_Supplier_Purchase_Order.HASH_PAGE_STORE_SUPPLIER_PURCHASE_ORDERS, methods=['GET'])
|
||||
def supplier_purchase_orders():
|
||||
print('supplier_purchase_orders')
|
||||
Helper_App.console_log('supplier_purchase_orders')
|
||||
try:
|
||||
form_filters = Filters_Supplier_Purchase_Order.from_json(request.args)
|
||||
except Exception as e:
|
||||
print(f'Error: {e}')
|
||||
Helper_App.console_log(f'Error: {e}')
|
||||
form_filters = Filters_Supplier_Purchase_Order()
|
||||
print(f'form_filters={form_filters}')
|
||||
Helper_App.console_log(f'form_filters={form_filters}')
|
||||
model = Model_View_Store_Supplier_Purchase_Order(form_filters)
|
||||
if not model.is_user_logged_in:
|
||||
return redirect(url_for('routes_core.home'))
|
||||
@@ -80,7 +80,7 @@ def save_supplier_purchase_order():
|
||||
data = Helper_App.get_request_data(request)
|
||||
try:
|
||||
form_filters = Filters_Supplier_Purchase_Order.from_json(data[Model_View_Store_Supplier_Purchase_Order.FLAG_FORM_FILTERS])
|
||||
print(f'form_filters: {form_filters}')
|
||||
Helper_App.console_log(f'form_filters: {form_filters}')
|
||||
|
||||
supplier_purchase_orders = data[Model_View_Store_Supplier_Purchase_Order.FLAG_SUPPLIER_PURCHASE_ORDER]
|
||||
if len(supplier_purchase_orders) == 0:
|
||||
@@ -88,11 +88,11 @@ def save_supplier_purchase_order():
|
||||
Model_View_Store_Supplier_Purchase_Order.FLAG_STATUS: Model_View_Store_Supplier_Purchase_Order.FLAG_FAILURE,
|
||||
Model_View_Store_Supplier_Purchase_Order.FLAG_MESSAGE: f'No stock items.'
|
||||
})
|
||||
print(f'supplier_purchase_orders={supplier_purchase_orders}')
|
||||
Helper_App.console_log(f'supplier_purchase_orders={supplier_purchase_orders}')
|
||||
objs_supplier_purchase_order = []
|
||||
for supplier_purchase_order in supplier_purchase_orders:
|
||||
objs_supplier_purchase_order.append(Supplier_Purchase_Order.from_json(supplier_purchase_order))
|
||||
print(f'objs_supplier_purchase_order={objs_supplier_purchase_order}')
|
||||
Helper_App.console_log(f'objs_supplier_purchase_order={objs_supplier_purchase_order}')
|
||||
save_errors, save_warnings = Model_View_Store_Supplier_Purchase_Order.save_supplier_purchase_orders(data.get('comment', 'No comment'), objs_supplier_purchase_order)
|
||||
if len(save_errors) > 0:
|
||||
return jsonify({
|
||||
|
||||
@@ -38,27 +38,27 @@ def login():
|
||||
data = request.json
|
||||
except:
|
||||
data = {}
|
||||
print(f'data={data}')
|
||||
Helper_App.console_log(f'data={data}')
|
||||
# callback_login = F'{Model_View_Base.HASH_CALLBACK_LOGIN}{data.get(Model_View_Base.FLAG_CALLBACK, Model_View_Base.HASH_PAGE_HOME)}'
|
||||
|
||||
# encoded_path = quote(data.get(Model_View_Base.FLAG_CALLBACK, Model_View_Base.HASH_PAGE_HOME))
|
||||
uri_redirect = url_for('routes_user.login_callback', _external=True) # , subpath=encoded_path
|
||||
|
||||
# uri_redirect = f'{current_app.URL_HOST}/login_callback?subpath={data.get(Model_View_Base.FLAG_CALLBACK, Model_View_Base.HASH_PAGE_HOME)}'
|
||||
print(f'redirect uri: {uri_redirect}')
|
||||
Helper_App.console_log(f'redirect uri: {uri_redirect}')
|
||||
hash_callback = data.get(Model_View_Base.FLAG_CALLBACK, Model_View_Base.HASH_PAGE_HOME)
|
||||
print(f'hash_callback: {hash_callback}')
|
||||
Helper_App.console_log(f'hash_callback: {hash_callback}')
|
||||
|
||||
red = oauth.auth0.authorize_redirect(
|
||||
redirect_uri = uri_redirect,
|
||||
state = quote(hash_callback)
|
||||
)
|
||||
print(f'redirect: {red}')
|
||||
Helper_App.console_log(f'redirect: {red}')
|
||||
headers = red.headers['Location']
|
||||
print(f'headers: {headers}')
|
||||
Helper_App.console_log(f'headers: {headers}')
|
||||
parsed_url = urlparse(headers)
|
||||
query_params = parse_qs(parsed_url.query)
|
||||
print(f"""
|
||||
Helper_App.console_log(f"""
|
||||
OAuth Authorize Redirect URL:
|
||||
|
||||
Base URL: {parsed_url.scheme}://{parsed_url.netloc}{parsed_url.path}
|
||||
@@ -76,25 +76,25 @@ def login_callback():
|
||||
if has_error:
|
||||
error_description = request.args.get(Model_View_User.FLAG_ERROR_DESCRIPTION_OAUTH)
|
||||
error_text = f'Error: {error_state}: {error_description}'
|
||||
print(error_text)
|
||||
Helper_App.console_log(error_text)
|
||||
return login()
|
||||
# print(f'code: {code}')
|
||||
# Helper_App.console_log(f'code: {code}')
|
||||
token = None
|
||||
try:
|
||||
token = oauth.auth0.authorize_access_token()
|
||||
except Exception as e:
|
||||
# Log the error for debugging
|
||||
print(f"Error: {str(e)}")
|
||||
Helper_App.console_log(f"Error: {str(e)}")
|
||||
session[current_app.config['ID_TOKEN_USER']] = token
|
||||
# import user id
|
||||
"""
|
||||
print(f'str(type(token)) = {str(type(token))}')
|
||||
print(f'token = {token}')
|
||||
Helper_App.console_log(f'str(type(token)) = {str(type(token))}')
|
||||
Helper_App.console_log(f'token = {token}')
|
||||
userinfo = token.get('userinfo')
|
||||
print(f'user info: {userinfo}')
|
||||
Helper_App.console_log(f'user info: {userinfo}')
|
||||
# id_user = token.get('sub')
|
||||
id_user = userinfo.get('sub')
|
||||
print(f'user ID: {id_user}')
|
||||
Helper_App.console_log(f'user ID: {id_user}')
|
||||
"""
|
||||
user = User.from_json_auth0(token) # datastore_user.get_user_auth0()
|
||||
user_filters = User_Filters.from_user(user)
|
||||
@@ -102,30 +102,30 @@ def login_callback():
|
||||
users, errors = datastore_user.get_many_user(user_filters, user)
|
||||
try:
|
||||
user = users[0]
|
||||
print('User logged in')
|
||||
print(f'user ({str(type(user))}): {user}')
|
||||
print(f'user key: {Model_View_Base.FLAG_USER}')
|
||||
Helper_App.console_log('User logged in')
|
||||
Helper_App.console_log(f'user ({str(type(user))}): {user}')
|
||||
Helper_App.console_log(f'user key: {Model_View_Base.FLAG_USER}')
|
||||
user_json = user.to_json()
|
||||
session[Model_View_Base.FLAG_USER] = user_json
|
||||
print(f'user stored on session')
|
||||
Helper_App.console_log(f'user stored on session')
|
||||
except:
|
||||
print(f'User not found: {user_filters}\nDatabase query error: {errors}')
|
||||
Helper_App.console_log(f'User not found: {user_filters}\nDatabase query error: {errors}')
|
||||
|
||||
try:
|
||||
hash_callback = token.get('hash_callback')
|
||||
if hash_callback is None:
|
||||
print('hash is none')
|
||||
Helper_App.console_log('hash is none')
|
||||
state = request.args.get('state')
|
||||
print(f'state: {state}')
|
||||
Helper_App.console_log(f'state: {state}')
|
||||
hash_callback = state # .get('hash_callback')
|
||||
print(f'hash_callback: {hash_callback}')
|
||||
Helper_App.console_log(f'hash_callback: {hash_callback}')
|
||||
except:
|
||||
print("get hash callback failed")
|
||||
Helper_App.console_log("get hash callback failed")
|
||||
# id_user = get_id_user()
|
||||
# add user to database
|
||||
# DataStore_Store().add_new_user(id_user) # this is part of get basket - should occur on page load
|
||||
|
||||
print(f'user session: {session[Model_View_Base.FLAG_USER]}')
|
||||
Helper_App.console_log(f'user session: {session[Model_View_Base.FLAG_USER]}')
|
||||
return redirect(f"{current_app.config['URL_HOST']}{hash_callback}")
|
||||
except Exception as e:
|
||||
return jsonify({Model_View_Base.FLAG_STATUS: Model_View_Base.FLAG_FAILURE, Model_View_Base.FLAG_MESSAGE: f'Controller error.\n{e}'})
|
||||
@@ -141,7 +141,7 @@ def logout():
|
||||
# quote_via=quote_plus,
|
||||
)
|
||||
current_app.logger.debug(f"Redirecting to {url_logout}")
|
||||
print(f"Redirecting to {url_logout}")
|
||||
Helper_App.console_log(f"Redirecting to {url_logout}")
|
||||
return redirect(url_logout)
|
||||
|
||||
@routes_user.route("/logout_callback") # <path:subpath>/<code>
|
||||
@@ -153,18 +153,18 @@ def logout_callback():
|
||||
try:
|
||||
hash_callback = token.get('hash_callback')
|
||||
if hash_callback is None:
|
||||
print('hash is none')
|
||||
Helper_App.console_log('hash is none')
|
||||
state = request.args.get('state')
|
||||
print(f'state: {state}')
|
||||
Helper_App.console_log(f'state: {state}')
|
||||
hash_callback = state # .get('hash_callback')
|
||||
print(f'hash_callback: {hash_callback}')
|
||||
Helper_App.console_log(f'hash_callback: {hash_callback}')
|
||||
except:
|
||||
print("get hash callback failed")
|
||||
Helper_App.console_log("get hash callback failed")
|
||||
# id_user = get_id_user()
|
||||
# add user to database
|
||||
# DataStore_Store().add_new_user(id_user) # this is part of get basket - should occur on page load
|
||||
|
||||
print(f'user session: {session[Model_View_Base.FLAG_USER]}')
|
||||
Helper_App.console_log(f'user session: {session[Model_View_Base.FLAG_USER]}')
|
||||
return redirect(f'{current_app.URL_HOST}{hash_callback}')
|
||||
except Exception as e:
|
||||
return jsonify({Model_View_Base.FLAG_STATUS: Model_View_Base.FLAG_FAILURE, Model_View_Base.FLAG_MESSAGE: f'Controller error.\n{e}'})
|
||||
|
||||
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.
@@ -35,6 +35,7 @@ from business_objects.user import User, User_Filters, User_Permission_Evaluation
|
||||
from extensions import db
|
||||
from forms.access_level import Filters_Access_Level
|
||||
from forms.unit_measurement import Filters_Unit_Measurement
|
||||
from helpers.helper_app import Helper_App
|
||||
# external
|
||||
# from abc import ABC, abstractmethod, abstractproperty
|
||||
from flask_sqlalchemy import SQLAlchemy
|
||||
@@ -86,7 +87,7 @@ class DataStore_Base(BaseModel):
|
||||
proc_string += f'{"" if i == 0 else ", "}:{arg_keys[i]}'
|
||||
proc_string += ')'
|
||||
proc_string = text(proc_string)
|
||||
print(f'{_m}\nproc_string: {proc_string}\nargs: {argument_dict_list}')
|
||||
Helper_App.console_log(f'{_m}\nproc_string: {proc_string}\nargs: {argument_dict_list}')
|
||||
|
||||
# with self.db.session.begin() as session:
|
||||
# conn = Helper_DB_MySQL(self.app).get_db_connection()
|
||||
@@ -95,20 +96,20 @@ class DataStore_Base(BaseModel):
|
||||
result = db.session.execute(proc_string, argument_dict_list)
|
||||
else:
|
||||
result = db.session.execute(proc_string)
|
||||
print(f'result: {result}')
|
||||
Helper_App.console_log(f'result: {result}')
|
||||
# conn.session.remove()
|
||||
return result
|
||||
cursor = result.cursor
|
||||
result_set_1 = cursor.fetchall()
|
||||
print(f'categories: {result_set_1}')
|
||||
Helper_App.console_log(f'categories: {result_set_1}')
|
||||
cursor.nextset()
|
||||
result_set_2 = cursor.fetchall()
|
||||
print(f'products: {result_set_2}')
|
||||
Helper_App.console_log(f'products: {result_set_2}')
|
||||
|
||||
@staticmethod
|
||||
def db_cursor_clear(cursor):
|
||||
while cursor.nextset():
|
||||
print(f'new result set: {cursor.fetchall()}')
|
||||
Helper_App.console_log(f'new result set: {cursor.fetchall()}')
|
||||
@classmethod
|
||||
def get_many_region_and_currency(cls):
|
||||
_m = 'DataStore_Base.get_many_region_and_currency'
|
||||
@@ -122,10 +123,10 @@ class DataStore_Base(BaseModel):
|
||||
'a_get_inactive_currency': 0
|
||||
}
|
||||
|
||||
print(f'executing {_m_db_currency}')
|
||||
Helper_App.console_log(f'executing {_m_db_currency}')
|
||||
result = cls.db_procedure_execute(_m_db_currency, argument_dict_list_currency)
|
||||
cursor = result.cursor
|
||||
print('data received')
|
||||
Helper_App.console_log('data received')
|
||||
|
||||
# cursor.nextset()
|
||||
result_set_1 = cursor.fetchall()
|
||||
@@ -133,13 +134,13 @@ class DataStore_Base(BaseModel):
|
||||
for row in result_set_1:
|
||||
currency = Currency.make_from_DB_currency(row)
|
||||
currencies.append(currency)
|
||||
print(f'currencies: {currencies}')
|
||||
Helper_App.console_log(f'currencies: {currencies}')
|
||||
DataStore_Base.db_cursor_clear(cursor)
|
||||
|
||||
print(f'executing {_m_db_region}')
|
||||
Helper_App.console_log(f'executing {_m_db_region}')
|
||||
result = cls.db_procedure_execute(_m_db_region, argument_dict_list_region)
|
||||
cursor = result.cursor
|
||||
print('data received')
|
||||
Helper_App.console_log('data received')
|
||||
|
||||
# cursor.nextset()
|
||||
result_set_1 = cursor.fetchall()
|
||||
@@ -147,25 +148,25 @@ class DataStore_Base(BaseModel):
|
||||
for row in result_set_1:
|
||||
region = Region.make_from_DB_region(row)
|
||||
regions.append(region)
|
||||
print(f'regions: {regions}')
|
||||
Helper_App.console_log(f'regions: {regions}')
|
||||
DataStore_Base.db_cursor_clear(cursor)
|
||||
cursor.close()
|
||||
|
||||
return regions, currencies
|
||||
@staticmethod
|
||||
def get_user_session():
|
||||
print('DataStore_Base.get_user_session')
|
||||
Helper_App.console_log('DataStore_Base.get_user_session')
|
||||
return User.from_json(session.get(User.FLAG_USER))
|
||||
user = User.get_default()
|
||||
try:
|
||||
print(f'user session: {session[self.app.ID_TOKEN_USER]}')
|
||||
Helper_App.console_log(f'user session: {session[self.app.ID_TOKEN_USER]}')
|
||||
info_user = session[self.app.ID_TOKEN_USER].get('userinfo')
|
||||
print(f'info_user: {info_user}')
|
||||
Helper_App.console_log(f'info_user: {info_user}')
|
||||
user.is_logged_in = ('sub' in list(info_user.keys()) and not info_user['sub'] == '' and not str(type(info_user['sub'])) == "<class 'NoneType'?")
|
||||
user.id_user_auth0 = info_user['sub'] if user.is_logged_in else None
|
||||
print(f'user.id_user_auth0: {user.id_user_auth0}')
|
||||
Helper_App.console_log(f'user.id_user_auth0: {user.id_user_auth0}')
|
||||
except:
|
||||
print('get user login failed')
|
||||
Helper_App.console_log('get user login failed')
|
||||
return user
|
||||
"""
|
||||
@staticmethod
|
||||
@@ -175,39 +176,39 @@ class DataStore_Base(BaseModel):
|
||||
@staticmethod
|
||||
def upload_bulk(permanent_table_name, records, batch_size):
|
||||
_m = 'DataStore_Base.upload_bulk'
|
||||
print(f'{_m}\nstarting...')
|
||||
print(f'permanent_table_name: {permanent_table_name}')
|
||||
Helper_App.console_log(f'{_m}\nstarting...')
|
||||
Helper_App.console_log(f'permanent_table_name: {permanent_table_name}')
|
||||
if db.session.dirty or db.session.new or db.session.deleted:
|
||||
print("Session is not clean")
|
||||
Helper_App.console_log("Session is not clean")
|
||||
return
|
||||
# Assuming `permanent_table_name` is a string representing the table name
|
||||
table_object = db.metadata.tables.get(permanent_table_name)
|
||||
if table_object is None:
|
||||
print(f"Table {permanent_table_name} not found in metadata.")
|
||||
Helper_App.console_log(f"Table {permanent_table_name} not found in metadata.")
|
||||
return
|
||||
else:
|
||||
expected_columns = set(column.name for column in db.inspect(table_object).columns)
|
||||
print(f'expected_columns: {expected_columns}')
|
||||
Helper_App.console_log(f'expected_columns: {expected_columns}')
|
||||
|
||||
try:
|
||||
for i in range(0, len(records), batch_size):
|
||||
batch = records[i:i+batch_size]
|
||||
print(f'batch: {batch}')
|
||||
Helper_App.console_log(f'batch: {batch}')
|
||||
db.session.bulk_save_objects(batch)
|
||||
"""
|
||||
data = [object.to_json() for object in batch]
|
||||
print(f'data: {data}')
|
||||
Helper_App.console_log(f'data: {data}')
|
||||
for row in data:
|
||||
row_keys = set(row.keys())
|
||||
if row_keys != expected_columns:
|
||||
print(f"Column mismatch in row: {row}")
|
||||
print(f'missing columns: {expected_columns - row_keys}')
|
||||
print(f'extra columns: {row_keys - expected_columns}')
|
||||
Helper_App.console_log(f"Column mismatch in row: {row}")
|
||||
Helper_App.console_log(f'missing columns: {expected_columns - row_keys}')
|
||||
Helper_App.console_log(f'extra columns: {row_keys - expected_columns}')
|
||||
# db.session.bulk_insert_mappings(permanent_table_name, data)
|
||||
"""
|
||||
db.session.commit()
|
||||
except Exception as e:
|
||||
print(f'{_m}\n{e}')
|
||||
Helper_App.console_log(f'{_m}\n{e}')
|
||||
db.session.rollback()
|
||||
raise e
|
||||
@classmethod
|
||||
@@ -219,15 +220,15 @@ class DataStore_Base(BaseModel):
|
||||
argument_dict = filters.to_json()
|
||||
# user = cls.get_user_session()
|
||||
# argument_dict['a_id_user'] = 1 # 'auth0|6582b95c895d09a70ba10fef' # id_user
|
||||
print(f'argument_dict: {argument_dict}')
|
||||
print('executing p_shop_get_many_access_level')
|
||||
Helper_App.console_log(f'argument_dict: {argument_dict}')
|
||||
Helper_App.console_log('executing p_shop_get_many_access_level')
|
||||
result = cls.db_procedure_execute('p_shop_get_many_access_level', argument_dict)
|
||||
cursor = result.cursor
|
||||
print('data received')
|
||||
Helper_App.console_log('data received')
|
||||
|
||||
# access_levels
|
||||
result_set_1 = cursor.fetchall()
|
||||
print(f'raw access levels: {result_set_1}')
|
||||
Helper_App.console_log(f'raw access levels: {result_set_1}')
|
||||
access_levels = []
|
||||
for row in result_set_1:
|
||||
new_access_level = Access_Level.from_DB_access_level(row)
|
||||
@@ -236,12 +237,12 @@ class DataStore_Base(BaseModel):
|
||||
# Errors
|
||||
cursor.nextset()
|
||||
result_set_e = cursor.fetchall()
|
||||
print(f'raw errors: {result_set_e}')
|
||||
Helper_App.console_log(f'raw errors: {result_set_e}')
|
||||
errors = []
|
||||
if len(result_set_e) > 0:
|
||||
errors = [SQL_Error.from_DB_record(row) for row in result_set_e] # (row[0], row[1])
|
||||
for error in errors:
|
||||
print(f"Error [{error.code}]: {error.msg}")
|
||||
Helper_App.console_log(f"Error [{error.code}]: {error.msg}")
|
||||
|
||||
DataStore_Base.db_cursor_clear(cursor)
|
||||
cursor.close()
|
||||
@@ -256,15 +257,15 @@ class DataStore_Base(BaseModel):
|
||||
argument_dict = filters.to_json()
|
||||
# user = cls.get_user_session()
|
||||
# argument_dict['a_id_user'] = 1 # 'auth0|6582b95c895d09a70ba10fef' # id_user
|
||||
print(f'argument_dict: {argument_dict}')
|
||||
print('executing p_shop_get_many_unit_measurement')
|
||||
Helper_App.console_log(f'argument_dict: {argument_dict}')
|
||||
Helper_App.console_log('executing p_shop_get_many_unit_measurement')
|
||||
result = cls.db_procedure_execute('p_shop_get_many_unit_measurement', argument_dict)
|
||||
cursor = result.cursor
|
||||
print('data received')
|
||||
Helper_App.console_log('data received')
|
||||
|
||||
# units of measurement
|
||||
result_set_1 = cursor.fetchall()
|
||||
print(f'raw units of measurement: {result_set_1}')
|
||||
Helper_App.console_log(f'raw units of measurement: {result_set_1}')
|
||||
units = []
|
||||
for row in result_set_1:
|
||||
new_unit = Unit_Measurement.from_DB_unit_measurement(row)
|
||||
@@ -273,12 +274,12 @@ class DataStore_Base(BaseModel):
|
||||
# Errors
|
||||
cursor.nextset()
|
||||
result_set_e = cursor.fetchall()
|
||||
print(f'raw errors: {result_set_e}')
|
||||
Helper_App.console_log(f'raw errors: {result_set_e}')
|
||||
errors = []
|
||||
if len(result_set_e) > 0:
|
||||
errors = [SQL_Error.from_DB_record(row) for row in result_set_e] # (row[0], row[1])
|
||||
for error in errors:
|
||||
print(f"Error [{error.code}]: {error.msg}")
|
||||
Helper_App.console_log(f"Error [{error.code}]: {error.msg}")
|
||||
|
||||
DataStore_Base.db_cursor_clear(cursor)
|
||||
cursor.close()
|
||||
|
||||
@@ -27,6 +27,7 @@ from business_objects.user import User, User_Filters, User_Permission_Evaluation
|
||||
from business_objects.store.product_variation import Product_Variation_Type, Product_Variation, Product_Variation_Filters, Product_Variation_Container
|
||||
from datastores.datastore_base import DataStore_Base
|
||||
from extensions import db
|
||||
from helpers.helper_app import Helper_App
|
||||
from helpers.helper_db_mysql import Helper_DB_MySQL
|
||||
import lib.argument_validation as av
|
||||
# from models.model_view_store_checkout import Model_View_Store_Checkout # circular!
|
||||
@@ -70,38 +71,38 @@ class DataStore_Store_Base(DataStore_Base):
|
||||
, **argument_dict
|
||||
, 'a_debug': 0
|
||||
}
|
||||
print(f'argument_dict: {argument_dict}')
|
||||
print('executing p_shop_get_many_product')
|
||||
Helper_App.console_log(f'argument_dict: {argument_dict}')
|
||||
Helper_App.console_log('executing p_shop_get_many_product')
|
||||
result = cls.db_procedure_execute('p_shop_get_many_product', argument_dict)
|
||||
cursor = result.cursor
|
||||
print('data received')
|
||||
Helper_App.console_log('data received')
|
||||
|
||||
|
||||
category_list = Product_Category_Container()
|
||||
print(f'initial category_list: {category_list}')
|
||||
Helper_App.console_log(f'initial category_list: {category_list}')
|
||||
|
||||
# Categories
|
||||
result_set_1 = cursor.fetchall()
|
||||
print(f'raw categories: {result_set_1}')
|
||||
Helper_App.console_log(f'raw categories: {result_set_1}')
|
||||
for row in result_set_1:
|
||||
new_category = Product_Category.from_DB_get_many_product_catalogue(row)
|
||||
print(f'new_category: {new_category}')
|
||||
Helper_App.console_log(f'new_category: {new_category}')
|
||||
category_list.add_product_category(new_category)
|
||||
|
||||
print(f'category-loaded category_list: {category_list}')
|
||||
Helper_App.console_log(f'category-loaded category_list: {category_list}')
|
||||
|
||||
# Products
|
||||
cursor.nextset()
|
||||
result_set_2 = cursor.fetchall()
|
||||
print(f'raw products: {result_set_2}')
|
||||
Helper_App.console_log(f'raw products: {result_set_2}')
|
||||
for row in result_set_2:
|
||||
print(f'row: {row}')
|
||||
Helper_App.console_log(f'row: {row}')
|
||||
new_product = Product.from_DB_get_many_product_catalogue(row)
|
||||
print(f'new_product: {new_product}')
|
||||
Helper_App.console_log(f'new_product: {new_product}')
|
||||
try:
|
||||
category_list.add_product(new_product)
|
||||
except Exception as e:
|
||||
print(f'Error adding product: {e}')
|
||||
Helper_App.console_log(f'Error adding product: {e}')
|
||||
|
||||
# Permutations
|
||||
cursor.nextset()
|
||||
@@ -111,7 +112,7 @@ class DataStore_Store_Base(DataStore_Base):
|
||||
try:
|
||||
category_list.add_product_permutation(new_permutation)
|
||||
except Exception as e:
|
||||
print(f'Error adding permutation: {e}')
|
||||
Helper_App.console_log(f'Error adding permutation: {e}')
|
||||
|
||||
# Product_Variations
|
||||
cursor.nextset()
|
||||
@@ -121,7 +122,7 @@ class DataStore_Store_Base(DataStore_Base):
|
||||
try:
|
||||
category_list.add_product_variation(new_variation)
|
||||
except Exception as e:
|
||||
print(f'Error adding variation: {e}')
|
||||
Helper_App.console_log(f'Error adding variation: {e}')
|
||||
|
||||
# Images
|
||||
cursor.nextset()
|
||||
@@ -133,20 +134,20 @@ class DataStore_Store_Base(DataStore_Base):
|
||||
# Errors
|
||||
cursor.nextset()
|
||||
result_set_e = cursor.fetchall()
|
||||
print(f'raw errors: {result_set_e}')
|
||||
Helper_App.console_log(f'raw errors: {result_set_e}')
|
||||
errors = []
|
||||
if len(result_set_e) > 0:
|
||||
errors = [SQL_Error.from_DB_record(row) for row in result_set_e] # (row[0], row[1])
|
||||
for error in errors:
|
||||
print(f"Error [{error.code}]: {error.msg}")
|
||||
Helper_App.console_log(f"Error [{error.code}]: {error.msg}")
|
||||
|
||||
category_list.get_all_product_variation_trees()
|
||||
"""
|
||||
for category in category_list.categories:
|
||||
print(f'category: {category.name}')
|
||||
Helper_App.console_log(f'category: {category.name}')
|
||||
for product in category.products:
|
||||
permutation = product.get_permutation_selected()
|
||||
print(f'product: {product.name}\nselected permutation: {permutation}')
|
||||
Helper_App.console_log(f'product: {product.name}\nselected permutation: {permutation}')
|
||||
"""
|
||||
|
||||
if len(errors) > 0:
|
||||
@@ -168,7 +169,7 @@ class DataStore_Store_Base(DataStore_Base):
|
||||
DataStore_Store_Base.db_cursor_clear(cursor)
|
||||
cursor.close()
|
||||
|
||||
print(f'get many category_list: {category_list}')
|
||||
Helper_App.console_log(f'get many category_list: {category_list}')
|
||||
return category_list, errors # categories, category_index
|
||||
|
||||
"""
|
||||
@@ -201,10 +202,10 @@ class DataStore_Store_Base(DataStore_Base):
|
||||
'a_get_inactive_currency': 0
|
||||
}
|
||||
|
||||
print(f'executing {_m_db_currency}')
|
||||
Helper_App.console_log(f'executing {_m_db_currency}')
|
||||
result = cls.db_procedure_execute(_m_db_currency, argument_dict_list_currency)
|
||||
cursor = result.cursor
|
||||
print('data received')
|
||||
Helper_App.console_log('data received')
|
||||
|
||||
# cursor.nextset()
|
||||
result_set_1 = cursor.fetchall()
|
||||
@@ -212,7 +213,7 @@ class DataStore_Store_Base(DataStore_Base):
|
||||
for row in result_set_1:
|
||||
currency = Currency.from_DB_currency(row)
|
||||
currencies.append(currency)
|
||||
print(f'currencies: {currencies}')
|
||||
Helper_App.console_log(f'currencies: {currencies}')
|
||||
DataStore_Store_Base.db_cursor_clear(cursor)
|
||||
|
||||
return currencies
|
||||
@@ -226,10 +227,10 @@ class DataStore_Store_Base(DataStore_Base):
|
||||
'a_get_inactive_currency': 0
|
||||
}
|
||||
|
||||
print(f'executing {_m_db_region}')
|
||||
Helper_App.console_log(f'executing {_m_db_region}')
|
||||
result = cls.db_procedure_execute(_m_db_region, argument_dict_list_region)
|
||||
cursor = result.cursor
|
||||
print('data received')
|
||||
Helper_App.console_log('data received')
|
||||
|
||||
# cursor.nextset()
|
||||
result_set_1 = cursor.fetchall()
|
||||
@@ -237,7 +238,7 @@ class DataStore_Store_Base(DataStore_Base):
|
||||
for row in result_set_1:
|
||||
region = Region.from_DB_region(row)
|
||||
regions.append(region)
|
||||
print(f'regions: {regions}')
|
||||
Helper_App.console_log(f'regions: {regions}')
|
||||
DataStore_Store_Base.db_cursor_clear(cursor)
|
||||
cursor.close()
|
||||
|
||||
@@ -253,7 +254,7 @@ class DataStore_Store_Base(DataStore_Base):
|
||||
@classmethod
|
||||
def get_many_product_variation(cls, variation_filters):
|
||||
_m = 'DataStore_Store_Base.get_many_product_variation'
|
||||
print(_m)
|
||||
Helper_App.console_log(_m)
|
||||
av.val_instance(variation_filters, 'variation_filters', _m, Product_Variation_Filters)
|
||||
|
||||
guid = Helper_DB_MySQL.create_guid()
|
||||
@@ -290,7 +291,7 @@ class DataStore_Store_Base(DataStore_Base):
|
||||
variation_types.append(new_variation_type)
|
||||
variation_types_dict[new_variation_type.id_type] = new_variation_type
|
||||
|
||||
print(f'variation_types_dict: {variation_types_dict}')
|
||||
Helper_App.console_log(f'variation_types_dict: {variation_types_dict}')
|
||||
|
||||
# Product_Variations
|
||||
cursor.nextset()
|
||||
@@ -306,11 +307,11 @@ class DataStore_Store_Base(DataStore_Base):
|
||||
errors = []
|
||||
cursor.nextset()
|
||||
result_set_e = cursor.fetchall()
|
||||
print(f'raw errors: {result_set_e}')
|
||||
Helper_App.console_log(f'raw errors: {result_set_e}')
|
||||
if len(result_set_e) > 0:
|
||||
errors = [SQL_Error.from_DB_record(row) for row in result_set_e] # [SQL_Error(row[0], row[1]) for row in result_set_e]
|
||||
for error in errors:
|
||||
print(f"Error [{error.code}]: {error.msg}")
|
||||
Helper_App.console_log(f"Error [{error.code}]: {error.msg}")
|
||||
|
||||
DataStore_Store_Base.db_cursor_clear(cursor)
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ from business_objects.store.stock_item import Stock_Item
|
||||
from business_objects.user import User, User_Filters, User_Permission_Evaluation
|
||||
from business_objects.store.product_variation import Product_Variation, Product_Variation_Filters, Product_Variation_Container
|
||||
from datastores.datastore_store_base import DataStore_Store_Base
|
||||
from helpers.helper_app import Helper_App
|
||||
# from helpers.helper_db_mysql import Helper_DB_MySQL
|
||||
# from models.model_view_store_checkout import Model_View_Store_Checkout # circular!
|
||||
from extensions import db
|
||||
@@ -65,7 +66,7 @@ class DataStore_Store_Basket(DataStore_Store_Base):
|
||||
def edit_basket(self, ids_permutation_basket, quantities_permutation_basket, id_permutation_edit, quantity_permutation_edit, sum_not_edit, id_currency, id_region_delivery, is_included_VAT):
|
||||
# redundant argument validation?
|
||||
_m = 'DataStore_Store_Base.edit_basket'
|
||||
print(f'{_m}\nstarting...')
|
||||
Helper_App.console_log(f'{_m}\nstarting...')
|
||||
# av.val_instance(filters, 'filters', _m, Parameters_Product_Category)
|
||||
# av.val_str(ids_product_basket, 'ids_product_basket', _m)
|
||||
av.val_str(ids_permutation_basket, 'ids_permutation_basket', _m)
|
||||
@@ -75,24 +76,24 @@ class DataStore_Store_Basket(DataStore_Store_Base):
|
||||
if id_product_edit == 'None':
|
||||
id_product_edit = None
|
||||
else:
|
||||
print(f'id_product_edit: {id_product_edit}')
|
||||
Helper_App.console_log(f'id_product_edit: {id_product_edit}')
|
||||
av.val_int(id_product_edit, 'id_product_edit', _m)
|
||||
"""
|
||||
if id_permutation_edit == 'None' or str(type(id_permutation_edit)) =="<class 'NoneType'>":
|
||||
id_permutation_edit = None
|
||||
else:
|
||||
print(f'id_permutation_edit: {id_permutation_edit}')
|
||||
print(str(type(id_permutation_edit)))
|
||||
Helper_App.console_log(f'id_permutation_edit: {id_permutation_edit}')
|
||||
Helper_App.console_log(str(type(id_permutation_edit)))
|
||||
av.val_int(id_permutation_edit, 'id_permutation_edit', _m)
|
||||
if quantity_permutation_edit == 'None' or str(type(quantity_permutation_edit)) =="<class 'NoneType'>":
|
||||
quantity_permutation_edit = None
|
||||
else:
|
||||
print(f'quantity_permutation_edit: {quantity_permutation_edit}')
|
||||
Helper_App.console_log(f'quantity_permutation_edit: {quantity_permutation_edit}')
|
||||
av.val_int(quantity_permutation_edit, 'quantity_permutation_edit', _m)
|
||||
if sum_not_edit == 'None':
|
||||
sum_not_edit = None
|
||||
else:
|
||||
print(f'sum_not_edit: {sum_not_edit}')
|
||||
Helper_App.console_log(f'sum_not_edit: {sum_not_edit}')
|
||||
av.val_bool(sum_not_edit, 'sum_not_edit', _m)
|
||||
|
||||
argument_dict_list = {
|
||||
@@ -110,21 +111,21 @@ class DataStore_Store_Basket(DataStore_Store_Base):
|
||||
}
|
||||
|
||||
result = self.db_procedure_execute('p_shop_edit_user_basket', argument_dict_list)
|
||||
print('data received')
|
||||
Helper_App.console_log('data received')
|
||||
|
||||
cursor = result.cursor
|
||||
|
||||
# categories, category_index = DataStore_Store_Base.input_many_product(cursor)
|
||||
category_list, errors = DataStore_Store_Base.input_many_product(cursor)
|
||||
|
||||
print(f'cursor: {str(cursor)}')
|
||||
Helper_App.console_log(f'cursor: {str(cursor)}')
|
||||
|
||||
# Basket
|
||||
if not cursor.nextset():
|
||||
raise Exception("No more query results! Cannot open basket contents")
|
||||
result_set = cursor.fetchall()
|
||||
print(f'raw basket: {result_set}')
|
||||
# print(f'variations: {result_set_3}')
|
||||
Helper_App.console_log(f'raw basket: {result_set}')
|
||||
# Helper_App.console_log(f'variations: {result_set_3}')
|
||||
# variations = [Product_Variation(**row) for row in result_set_3]
|
||||
basket = Basket(is_included_VAT, id_currency, id_region_delivery)
|
||||
for row in result_set:
|
||||
@@ -133,20 +134,20 @@ class DataStore_Store_Basket(DataStore_Store_Base):
|
||||
index_product = category.get_index_product_from_id(row[1])
|
||||
product = category.products[index_product]
|
||||
basket_item = Basket_Item.from_product_and_quantity_and_VAT_included(product, row[7], self.app.is_included_VAT)
|
||||
print(f'adding basket item: {row}')
|
||||
print(f'basket item: {basket_item}')
|
||||
Helper_App.console_log(f'adding basket item: {row}')
|
||||
Helper_App.console_log(f'basket item: {basket_item}')
|
||||
basket.add_item(basket_item) # basket.append(basket_item) # Basket_Item(category.name, product, row[4]))
|
||||
|
||||
print(f'basket: {basket}')
|
||||
Helper_App.console_log(f'basket: {basket}')
|
||||
|
||||
# Errors
|
||||
cursor.nextset()
|
||||
result_set_e = cursor.fetchall()
|
||||
print(f'raw errors: {result_set_e}')
|
||||
Helper_App.console_log(f'raw errors: {result_set_e}')
|
||||
if len(result_set_e) > 0:
|
||||
errors = [SQL_Error.from_DB_record(row) for row in result_set_e] # [SQL_Error(row[0], row[1]) for row in result_set_2]
|
||||
for error in errors:
|
||||
print(f"Error [{error.code}]: {error.msg}")
|
||||
Helper_App.console_log(f"Error [{error.code}]: {error.msg}")
|
||||
|
||||
DataStore_Store_Base.db_cursor_clear(cursor)
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ import lib.argument_validation as av
|
||||
from business_objects.sql_error import SQL_Error
|
||||
from business_objects.store.manufacturing_purchase_order import Manufacturing_Purchase_Order, Manufacturing_Purchase_Order_Product_Link, Parameters_Manufacturing_Purchase_Order, Manufacturing_Purchase_Order_Temp, Manufacturing_Purchase_Order_Product_Link_Temp
|
||||
from datastores.datastore_store_base import DataStore_Store_Base
|
||||
from helpers.helper_app import Helper_App
|
||||
from helpers.helper_db_mysql import Helper_DB_MySQL
|
||||
from extensions import db
|
||||
# external
|
||||
@@ -45,15 +46,15 @@ class DataStore_Store_Manufacturing_Purchase_Order(DataStore_Store_Base):
|
||||
, **argument_dict
|
||||
, 'a_debug': 0
|
||||
}
|
||||
print(f'argument_dict: {argument_dict}')
|
||||
print('executing p_shop_get_many_manufacturing_purchase_order')
|
||||
Helper_App.console_log(f'argument_dict: {argument_dict}')
|
||||
Helper_App.console_log('executing p_shop_get_many_manufacturing_purchase_order')
|
||||
result = self.db_procedure_execute('p_shop_get_many_manufacturing_purchase_order', argument_dict)
|
||||
cursor = result.cursor
|
||||
print('data received')
|
||||
Helper_App.console_log('data received')
|
||||
|
||||
# Manufacturing_Purchase_Orders
|
||||
result_set_1 = cursor.fetchall()
|
||||
print(f'raw manufacturing_purchase_orders: {result_set_1}')
|
||||
Helper_App.console_log(f'raw manufacturing_purchase_orders: {result_set_1}')
|
||||
manufacturing_purchase_orders = []
|
||||
indices_manufacturing_purchase_order = {}
|
||||
for row in result_set_1:
|
||||
@@ -64,7 +65,7 @@ class DataStore_Store_Manufacturing_Purchase_Order(DataStore_Store_Base):
|
||||
# Manufacturing_Purchase_Orders Items
|
||||
cursor.nextset()
|
||||
result_set_1 = cursor.fetchall()
|
||||
print(f'raw manufacturing_purchase_order_product_links: {result_set_1}')
|
||||
Helper_App.console_log(f'raw manufacturing_purchase_order_product_links: {result_set_1}')
|
||||
order_product_links = []
|
||||
for row in result_set_1:
|
||||
new_link = Manufacturing_Purchase_Order_Product_Link.from_DB_manufacturing_purchase_order(row)
|
||||
@@ -74,12 +75,12 @@ class DataStore_Store_Manufacturing_Purchase_Order(DataStore_Store_Base):
|
||||
# Errors
|
||||
cursor.nextset()
|
||||
result_set_e = cursor.fetchall()
|
||||
print(f'raw errors: {result_set_e}')
|
||||
Helper_App.console_log(f'raw errors: {result_set_e}')
|
||||
errors = []
|
||||
if len(result_set_e) > 0:
|
||||
errors = [SQL_Error.from_DB_record(row) for row in result_set_e] # (row[0], row[1])
|
||||
for error in errors:
|
||||
print(f"Error [{error.code}]: {error.msg}")
|
||||
Helper_App.console_log(f"Error [{error.code}]: {error.msg}")
|
||||
|
||||
DataStore_Store_Manufacturing_Purchase_Order.db_cursor_clear(cursor)
|
||||
|
||||
@@ -98,9 +99,9 @@ class DataStore_Store_Manufacturing_Purchase_Order(DataStore_Store_Base):
|
||||
row = Manufacturing_Purchase_Order_Temp.from_manufacturing_purchase_order(manufacturing_purchase_order)
|
||||
row.guid = guid
|
||||
rows_order.append(row)
|
||||
print(f'order rows: {rows_order}')
|
||||
Helper_App.console_log(f'order rows: {rows_order}')
|
||||
DataStore_Store_Base.upload_bulk(Manufacturing_Purchase_Order_Temp.__tablename__, rows_order, 1000)
|
||||
print('bulk uploaded orders')
|
||||
Helper_App.console_log('bulk uploaded orders')
|
||||
|
||||
rows_link = []
|
||||
for manufacturing_purchase_order in manufacturing_purchase_orders:
|
||||
@@ -108,9 +109,9 @@ class DataStore_Store_Manufacturing_Purchase_Order(DataStore_Store_Base):
|
||||
row = Manufacturing_Purchase_Order_Product_Link_Temp.from_manufacturing_purchase_order_product_link(link)
|
||||
row.guid = guid
|
||||
rows_link.append(row)
|
||||
print(f'link rows: {rows_link}')
|
||||
Helper_App.console_log(f'link rows: {rows_link}')
|
||||
DataStore_Store_Base.upload_bulk(Manufacturing_Purchase_Order_Product_Link_Temp.__tablename__, rows_link, 1000)
|
||||
print('bulk uploaded links')
|
||||
Helper_App.console_log('bulk uploaded links')
|
||||
|
||||
argument_dict_list = {
|
||||
'a_comment': comment,
|
||||
@@ -119,18 +120,18 @@ class DataStore_Store_Manufacturing_Purchase_Order(DataStore_Store_Base):
|
||||
'a_debug': 0
|
||||
}
|
||||
result = cls.db_procedure_execute('p_shop_save_manufacturing_purchase_order', argument_dict_list)
|
||||
print('saved manufacturing purchase orders')
|
||||
Helper_App.console_log('saved manufacturing purchase orders')
|
||||
|
||||
# Errors
|
||||
cursor = result.cursor
|
||||
cursor.nextset()
|
||||
result_set_e = cursor.fetchall()
|
||||
print(f'raw errors: {result_set_e}')
|
||||
Helper_App.console_log(f'raw errors: {result_set_e}')
|
||||
errors = []
|
||||
if len(result_set_e) > 0:
|
||||
errors = [SQL_Error.from_DB_record(row) for row in result_set_e]
|
||||
for error in errors:
|
||||
print(f"Error [{error.code}]: {error.msg}")
|
||||
Helper_App.console_log(f"Error [{error.code}]: {error.msg}")
|
||||
|
||||
DataStore_Store_Manufacturing_Purchase_Order.db_cursor_clear(cursor)
|
||||
return errors
|
||||
|
||||
@@ -15,6 +15,7 @@ import lib.argument_validation as av
|
||||
from business_objects.sql_error import SQL_Error
|
||||
from business_objects.store.product import Product, Product_Permutation, Product_Price, Parameters_Product, Product_Temp
|
||||
from datastores.datastore_store_base import DataStore_Store_Base
|
||||
from helpers.helper_app import Helper_App
|
||||
from helpers.helper_db_mysql import Helper_DB_MySQL
|
||||
# from models.model_view_store_checkout import Model_View_Store_Checkout # circular!
|
||||
from extensions import db
|
||||
@@ -86,8 +87,8 @@ class DataStore_Store_Product(DataStore_Store_Base):
|
||||
@classmethod
|
||||
def save_products(cls, comment, products):
|
||||
_m = 'DataStore_Store_Product.save_products'
|
||||
print(f'{_m}\nstarting...')
|
||||
print(f'comment: {comment}\nproducts: {products}')
|
||||
Helper_App.console_log(f'{_m}\nstarting...')
|
||||
Helper_App.console_log(f'comment: {comment}\nproducts: {products}')
|
||||
|
||||
guid = Helper_DB_MySQL.create_guid()
|
||||
user = cls.get_user_session()
|
||||
@@ -99,11 +100,11 @@ class DataStore_Store_Product(DataStore_Store_Base):
|
||||
id_product_new -= 1
|
||||
row.id_product = id_product_new
|
||||
else:
|
||||
print(f'row.id_product: {row.id_product}')
|
||||
Helper_App.console_log(f'row.id_product: {row.id_product}')
|
||||
row.guid = guid
|
||||
rows.append(row)
|
||||
|
||||
print(f'rows: {rows}')
|
||||
Helper_App.console_log(f'rows: {rows}')
|
||||
DataStore_Store_Base.upload_bulk(Product_Temp.__tablename__, rows, 1000)
|
||||
|
||||
argument_dict_list = {
|
||||
@@ -115,24 +116,24 @@ class DataStore_Store_Product(DataStore_Store_Base):
|
||||
save_result = cls.db_procedure_execute('p_shop_save_product', argument_dict_list)
|
||||
|
||||
cursor = save_result # .cursor
|
||||
print('data received')
|
||||
Helper_App.console_log('data received')
|
||||
|
||||
# Errors
|
||||
# cursor.nextset()
|
||||
result_set_e = cursor.fetchall()
|
||||
print(f'raw errors: {result_set_e}')
|
||||
Helper_App.console_log(f'raw errors: {result_set_e}')
|
||||
errors = []
|
||||
if len(result_set_e) > 0:
|
||||
errors = [SQL_Error.from_DB_record(row) for row in result_set_e] # (row[0], row[1])
|
||||
for error in errors:
|
||||
print(f"Error [{error.code}]: {error.msg}")
|
||||
Helper_App.console_log(f"Error [{error.code}]: {error.msg}")
|
||||
try:
|
||||
DataStore_Store_Base.db_cursor_clear(cursor)
|
||||
except Exception as e:
|
||||
print(f'Error clearing cursor: {e}')
|
||||
Helper_App.console_log(f'Error clearing cursor: {e}')
|
||||
cursor.close()
|
||||
|
||||
save_result.close()
|
||||
print('save procedure executed')
|
||||
Helper_App.console_log('save procedure executed')
|
||||
return errors
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ from business_objects.user import User, User_Filters, User_Permission_Evaluation
|
||||
from business_objects.store.product_variation import Product_Variation, Product_Variation_Filters, Product_Variation_Container
|
||||
# from datastores.datastore_base import Table_Shop_Product_Category, Table_Shop_Product_Category_Temp
|
||||
from datastores.datastore_store_base import DataStore_Store_Base
|
||||
from helpers.helper_app import Helper_App
|
||||
from helpers.helper_db_mysql import Helper_DB_MySQL
|
||||
# from models.model_view_store_checkout import Model_View_Store_Checkout # circular!
|
||||
from extensions import db
|
||||
@@ -48,8 +49,8 @@ class DataStore_Store_Product_Category(DataStore_Store_Base):
|
||||
@classmethod
|
||||
def save_categories(cls, comment, categories):
|
||||
_m = 'DataStore_Store_Product_Category.save_categories'
|
||||
print(f'{_m}\nstarting...')
|
||||
print(f'comment: {comment}\ncategories: {categories}')
|
||||
Helper_App.console_log(f'{_m}\nstarting...')
|
||||
Helper_App.console_log(f'comment: {comment}\ncategories: {categories}')
|
||||
# av.val_str(comment, 'comment', _m)
|
||||
# av.val_list_instances(categories, 'categories', _m, Product_Category, 1)
|
||||
|
||||
@@ -66,25 +67,25 @@ class DataStore_Store_Product_Category(DataStore_Store_Base):
|
||||
id_category_new -= 1
|
||||
row.id_category = id_category_new
|
||||
else:
|
||||
print(f'row.id_category: {row.id_category}')
|
||||
Helper_App.console_log(f'row.id_category: {row.id_category}')
|
||||
row.guid = guid
|
||||
# row.created_on = now
|
||||
# row.created_by = user.id_user
|
||||
rows.append(row)
|
||||
|
||||
print(f'rows: {rows}')
|
||||
Helper_App.console_log(f'rows: {rows}')
|
||||
"""
|
||||
cursor = db.cursor()
|
||||
print('cursor created')
|
||||
Helper_App.console_log('cursor created')
|
||||
cursor.executemany(
|
||||
'INSERT INTO Shop_Product_Category_Temp (id_category, code, name, description, active, display_order, guid, created_on, created_by) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)',
|
||||
categories
|
||||
)
|
||||
print('bulk upload executed')
|
||||
Helper_App.console_log('bulk upload executed')
|
||||
db.commit()
|
||||
print('bulk upload committed')
|
||||
Helper_App.console_log('bulk upload committed')
|
||||
cursor.close()
|
||||
print('cursor closed')
|
||||
Helper_App.console_log('cursor closed')
|
||||
"""
|
||||
DataStore_Store_Base.upload_bulk(Product_Category_Temp.__tablename__, rows, 1000)
|
||||
|
||||
@@ -95,5 +96,5 @@ class DataStore_Store_Product_Category(DataStore_Store_Base):
|
||||
}
|
||||
save_result = cls.db_procedure_execute('p_shop_save_product_category', argument_dict_list)
|
||||
save_result.close()
|
||||
print('save procedure executed')
|
||||
Helper_App.console_log('save procedure executed')
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ import lib.argument_validation as av
|
||||
from business_objects.store.store_base import Store_Base
|
||||
from business_objects.store.product_permutation import Product_Permutation, Product_Permutation_Temp
|
||||
from datastores.datastore_store_base import DataStore_Store_Base
|
||||
from helpers.helper_app import Helper_App
|
||||
from helpers.helper_db_mysql import Helper_DB_MySQL
|
||||
# from models.model_view_store_checkout import Model_View_Store_Checkout # circular!
|
||||
from extensions import db
|
||||
@@ -53,11 +54,11 @@ class DataStore_Store_Product_Permutation(DataStore_Store_Base):
|
||||
row.guid = guid
|
||||
rows.append(row)
|
||||
|
||||
print(f'rows: {rows}')
|
||||
Helper_App.console_log(f'rows: {rows}')
|
||||
|
||||
"""
|
||||
cursor = db.cursor()
|
||||
print('cursor created')
|
||||
Helper_App.console_log('cursor created')
|
||||
cursor.executemany(
|
||||
'''INSERT INTO Shop_Product_Permutation_Temp (
|
||||
id_permutation,
|
||||
@@ -85,14 +86,14 @@ class DataStore_Store_Product_Permutation(DataStore_Store_Base):
|
||||
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)''',
|
||||
rows
|
||||
)
|
||||
print('cursor executed')
|
||||
Helper_App.console_log('cursor executed')
|
||||
db.commit()
|
||||
print('cursor committed')
|
||||
Helper_App.console_log('cursor committed')
|
||||
cursor.close()
|
||||
print('cursor closed')
|
||||
Helper_App.console_log('cursor closed')
|
||||
"""
|
||||
DataStore_Store_Base.upload_bulk(Product_Permutation_Temp.__tablename__, rows, 1000)
|
||||
print('bulk uploaded')
|
||||
Helper_App.console_log('bulk uploaded')
|
||||
|
||||
argument_dict_list = {
|
||||
'a_comment': comment,
|
||||
@@ -100,4 +101,4 @@ class DataStore_Store_Product_Permutation(DataStore_Store_Base):
|
||||
'a_id_user': user.id_user,
|
||||
}
|
||||
cls.db_procedure_execute('p_shop_save_product_permutation', argument_dict_list)
|
||||
print('saved product permutations')
|
||||
Helper_App.console_log('saved product permutations')
|
||||
|
||||
@@ -16,6 +16,7 @@ import lib.argument_validation as av
|
||||
from business_objects.sql_error import SQL_Error
|
||||
from business_objects.store.stock_item import Stock_Item, Parameters_Stock_Item, Stock_Item_Temp
|
||||
from datastores.datastore_store_base import DataStore_Store_Base
|
||||
from helpers.helper_app import Helper_App
|
||||
from helpers.helper_db_mysql import Helper_DB_MySQL
|
||||
# from models.model_view_store_checkout import Model_View_Store_Checkout # circular!
|
||||
from extensions import db
|
||||
@@ -53,13 +54,13 @@ class DataStore_Store_Stock_Item(DataStore_Store_Base):
|
||||
, 'a_debug': 0
|
||||
}
|
||||
ids_permutation = category_list.get_csv_ids_permutation()
|
||||
print(f'ids_permutation: {ids_permutation}')
|
||||
Helper_App.console_log(f'ids_permutation: {ids_permutation}')
|
||||
argument_dict['a_ids_product_permutation'] = ids_permutation
|
||||
print(f'argument_dict: {argument_dict}')
|
||||
print('executing p_shop_get_many_stock_item')
|
||||
Helper_App.console_log(f'argument_dict: {argument_dict}')
|
||||
Helper_App.console_log('executing p_shop_get_many_stock_item')
|
||||
result = self.db_procedure_execute('p_shop_get_many_stock_item', argument_dict)
|
||||
cursor = result.cursor
|
||||
print('data received')
|
||||
Helper_App.console_log('data received')
|
||||
category_list, errors = DataStore_Store_Stock_Item.input_many_stock_item(cursor, category_list)
|
||||
DataStore_Store_Stock_Item.db_cursor_clear(cursor)
|
||||
|
||||
@@ -69,7 +70,7 @@ class DataStore_Store_Stock_Item(DataStore_Store_Base):
|
||||
def input_many_stock_item(cursor, category_list):
|
||||
_m = 'DataStore_Store_Stock_Item.input_many_stock_item'
|
||||
result_set_1 = cursor.fetchall()
|
||||
print(f'raw categories: {result_set_1}')
|
||||
Helper_App.console_log(f'raw categories: {result_set_1}')
|
||||
for row in result_set_1:
|
||||
new_stock_item = Stock_Item.from_DB_stock_item(row)
|
||||
category_list.add_stock_item(new_stock_item) # , row)
|
||||
@@ -77,12 +78,12 @@ class DataStore_Store_Stock_Item(DataStore_Store_Base):
|
||||
# Errors
|
||||
cursor.nextset()
|
||||
result_set_e = cursor.fetchall()
|
||||
print(f'raw errors: {result_set_e}')
|
||||
Helper_App.console_log(f'raw errors: {result_set_e}')
|
||||
errors = []
|
||||
if len(result_set_e) > 0:
|
||||
errors = [SQL_Error.from_DB_record(row) for row in result_set_e] # (row[0], row[1])
|
||||
for error in errors:
|
||||
print(f"Error [{error.code}]: {error.msg}")
|
||||
Helper_App.console_log(f"Error [{error.code}]: {error.msg}")
|
||||
"""
|
||||
if len(errors) > 0:
|
||||
for error in errors:
|
||||
@@ -117,10 +118,10 @@ class DataStore_Store_Stock_Item(DataStore_Store_Base):
|
||||
row.guid = guid
|
||||
rows.append(row)
|
||||
|
||||
print(f'rows: {rows}')
|
||||
Helper_App.console_log(f'rows: {rows}')
|
||||
|
||||
DataStore_Store_Base.upload_bulk(Stock_Item_Temp.__tablename__, rows, 1000)
|
||||
print('bulk uploaded')
|
||||
Helper_App.console_log('bulk uploaded')
|
||||
|
||||
argument_dict_list = {
|
||||
'a_comment': comment,
|
||||
@@ -129,17 +130,17 @@ class DataStore_Store_Stock_Item(DataStore_Store_Base):
|
||||
'a_debug': 0
|
||||
}
|
||||
result = cls.db_procedure_execute('p_shop_save_stock_item', argument_dict_list)
|
||||
print('saved product permutations')
|
||||
Helper_App.console_log('saved product permutations')
|
||||
|
||||
# Errors
|
||||
cursor = result.cursor
|
||||
cursor.nextset()
|
||||
result_set_e = cursor.fetchall()
|
||||
print(f'raw errors: {result_set_e}')
|
||||
Helper_App.console_log(f'raw errors: {result_set_e}')
|
||||
errors = []
|
||||
if len(result_set_e) > 0:
|
||||
errors = [SQL_Error.from_DB_record(row) for row in result_set_e] # (row[0], row[1])
|
||||
for error in errors:
|
||||
print(f"Error [{error.code}]: {error.msg}")
|
||||
Helper_App.console_log(f"Error [{error.code}]: {error.msg}")
|
||||
DataStore_Store_Stock_Item.db_cursor_clear(cursor)
|
||||
return errors
|
||||
|
||||
@@ -30,6 +30,7 @@ from datastores.datastore_store_base import DataStore_Store_Base
|
||||
# from helpers.helper_db_mysql import Helper_DB_MySQL
|
||||
# from models.model_view_store_checkout import Model_View_Store_Checkout # circular!
|
||||
from extensions import db
|
||||
from helpers.helper_app import Helper_App
|
||||
# external
|
||||
# from abc import ABC, abstractmethod, abstractproperty
|
||||
from flask_sqlalchemy import SQLAlchemy
|
||||
@@ -72,10 +73,10 @@ class DataStore_Store_Stripe(DataStore_Store_Base):
|
||||
'a_id_user': self.info_user
|
||||
}
|
||||
|
||||
print(f'executing {_m_db}')
|
||||
Helper_App.console_log(f'executing {_m_db}')
|
||||
result = self.db_procedure_execute(_m_db, argument_dict_list)
|
||||
cursor = result.cursor
|
||||
print('data received')
|
||||
Helper_App.console_log('data received')
|
||||
|
||||
|
||||
# Products
|
||||
@@ -85,16 +86,16 @@ class DataStore_Store_Stripe(DataStore_Store_Base):
|
||||
for row in result_set_1:
|
||||
new_product = Product.from_DB_Stripe_product(row) # Product(row[0], row[1], row[2], row[3], row[4], row[5], row[6], row[7], row[8], row[9], row[10], row[11], row[12], row[13], row[14], row[15], row[16], row[17], row[18], row[19])
|
||||
products.append(new_product)
|
||||
print(f'products: {products}')
|
||||
Helper_App.console_log(f'products: {products}')
|
||||
|
||||
# Errors
|
||||
cursor.nextset()
|
||||
result_set_e = cursor.fetchall()
|
||||
print(f'raw errors: {result_set_e}')
|
||||
Helper_App.console_log(f'raw errors: {result_set_e}')
|
||||
if len(result_set_e) > 0:
|
||||
errors = [SQL_Error.from_DB_record(row) for row in result_set_e] # [SQL_Error(row[0], row[1]) for row in result_set_e]
|
||||
for error in errors:
|
||||
print(f"Error [{error.code}]: {error.msg}")
|
||||
Helper_App.console_log(f"Error [{error.code}]: {error.msg}")
|
||||
|
||||
DataStore_Store_Stripe.db_cursor_clear(cursor)
|
||||
|
||||
@@ -110,10 +111,10 @@ class DataStore_Store_Stripe(DataStore_Store_Base):
|
||||
'a_id_user': self.info_user
|
||||
}
|
||||
|
||||
print(f'executing {_m_db}')
|
||||
Helper_App.console_log(f'executing {_m_db}')
|
||||
result = self.db_procedure_execute(_m_db, argument_dict_list)
|
||||
cursor = result.cursor
|
||||
print('data received')
|
||||
Helper_App.console_log('data received')
|
||||
|
||||
|
||||
# Products
|
||||
@@ -123,16 +124,16 @@ class DataStore_Store_Stripe(DataStore_Store_Base):
|
||||
for row in result_set_1:
|
||||
new_product = Product.from_DB_Stripe_price(row) # Product(row[0], row[1], row[2], row[3], row[4], row[5], row[6], row[7], row[8], row[9], row[10], row[11], row[12], row[13], row[14], row[15], row[16], row[17], row[18], row[19])
|
||||
products.append(new_product)
|
||||
print(f'products: {products}')
|
||||
Helper_App.console_log(f'products: {products}')
|
||||
|
||||
# Errors
|
||||
cursor.nextset()
|
||||
result_set_e = cursor.fetchall()
|
||||
print(f'raw errors: {result_set_e}')
|
||||
Helper_App.console_log(f'raw errors: {result_set_e}')
|
||||
if len(result_set_e) > 0:
|
||||
errors = [SQL_Error.from_DB_record(row) for row in result_set_e] # [SQL_Error(row[0], row[1]) for row in result_set_e]
|
||||
for error in errors:
|
||||
print(f"Error [{error.code}]: {error.msg}")
|
||||
Helper_App.console_log(f"Error [{error.code}]: {error.msg}")
|
||||
|
||||
DataStore_Store_Stripe.db_cursor_clear(cursor)
|
||||
|
||||
@@ -161,14 +162,14 @@ class DataStore_Store_Stripe(DataStore_Store_Base):
|
||||
# av.val_str(product_description, 'product_description', _m)
|
||||
av.val_instance(product, 'product', _m, Product)
|
||||
|
||||
print(f'stripe.api_key = {stripe.api_key}')
|
||||
Helper_App.console_log(f'stripe.api_key = {stripe.api_key}')
|
||||
new_product = stripe.Product.create(
|
||||
name = product.name,
|
||||
description = product.description,
|
||||
)
|
||||
|
||||
# Save these identifiers
|
||||
print(f"Success! Here is your new Stripe product id: {new_product.id}")
|
||||
Helper_App.console_log(f"Success! Here is your new Stripe product id: {new_product.id}")
|
||||
|
||||
return new_product.id
|
||||
|
||||
@@ -188,7 +189,7 @@ class DataStore_Store_Stripe(DataStore_Store_Base):
|
||||
av.val_instance(product, 'product', _m, Product)
|
||||
av.val_str(currency, 'currency', _m)
|
||||
|
||||
print(f'stripe.api_key = {stripe.api_key}')
|
||||
Helper_App.console_log(f'stripe.api_key = {stripe.api_key}')
|
||||
|
||||
new_product_price = stripe.Price.create(
|
||||
unit_amount = product.unit_price,
|
||||
@@ -198,7 +199,7 @@ class DataStore_Store_Stripe(DataStore_Store_Base):
|
||||
)
|
||||
|
||||
# Save these identifiers
|
||||
print(f"Success! Here is your Stripe product price id: {new_product_price.id} for {product.name}")
|
||||
Helper_App.console_log(f"Success! Here is your Stripe product price id: {new_product_price.id} for {product.name}")
|
||||
|
||||
return new_product_price.id
|
||||
|
||||
@@ -17,6 +17,7 @@ from business_objects.sql_error import SQL_Error
|
||||
from business_objects.store.supplier_address import Supplier_Address, Supplier_Address_Temp
|
||||
from business_objects.store.supplier import Supplier, Parameters_Supplier, Supplier_Temp
|
||||
from datastores.datastore_store_base import DataStore_Store_Base
|
||||
from helpers.helper_app import Helper_App
|
||||
from helpers.helper_db_mysql import Helper_DB_MySQL
|
||||
from extensions import db
|
||||
# external
|
||||
@@ -47,15 +48,15 @@ class DataStore_Store_Supplier(DataStore_Store_Base):
|
||||
, **argument_dict
|
||||
, 'a_debug': 0
|
||||
}
|
||||
print(f'argument_dict: {argument_dict}')
|
||||
print('executing p_shop_get_many_supplier')
|
||||
Helper_App.console_log(f'argument_dict: {argument_dict}')
|
||||
Helper_App.console_log('executing p_shop_get_many_supplier')
|
||||
result = cls.db_procedure_execute('p_shop_get_many_supplier', argument_dict)
|
||||
cursor = result.cursor
|
||||
print('data received')
|
||||
Helper_App.console_log('data received')
|
||||
|
||||
# Suppliers
|
||||
result_set_1 = cursor.fetchall()
|
||||
print(f'raw suppliers: {result_set_1}')
|
||||
Helper_App.console_log(f'raw suppliers: {result_set_1}')
|
||||
suppliers = []
|
||||
supplier_indexes = {}
|
||||
for row in result_set_1:
|
||||
@@ -66,7 +67,7 @@ class DataStore_Store_Supplier(DataStore_Store_Base):
|
||||
# Supplier Addresses
|
||||
cursor.nextset()
|
||||
result_set_1 = cursor.fetchall()
|
||||
print(f'raw supplier addresses: {result_set_1}')
|
||||
Helper_App.console_log(f'raw supplier addresses: {result_set_1}')
|
||||
for row in result_set_1:
|
||||
new_address = Supplier_Address.from_DB_supplier(row)
|
||||
index_supplier = supplier_indexes[new_address.id_supplier]
|
||||
@@ -75,12 +76,12 @@ class DataStore_Store_Supplier(DataStore_Store_Base):
|
||||
# Errors
|
||||
cursor.nextset()
|
||||
result_set_e = cursor.fetchall()
|
||||
print(f'raw errors: {result_set_e}')
|
||||
Helper_App.console_log(f'raw errors: {result_set_e}')
|
||||
errors = []
|
||||
if len(result_set_e) > 0:
|
||||
errors = [SQL_Error.from_DB_record(row) for row in result_set_e] # (row[0], row[1])
|
||||
for error in errors:
|
||||
print(f"Error [{error.code}]: {error.msg}")
|
||||
Helper_App.console_log(f"Error [{error.code}]: {error.msg}")
|
||||
|
||||
DataStore_Store_Supplier.db_cursor_clear(cursor)
|
||||
|
||||
@@ -89,7 +90,7 @@ class DataStore_Store_Supplier(DataStore_Store_Base):
|
||||
@classmethod
|
||||
def save_suppliers(cls, comment, suppliers):
|
||||
_m = 'DataStore_Store_Supplier.save_suppliers'
|
||||
print(f'{_m}\n{suppliers}')
|
||||
Helper_App.console_log(f'{_m}\n{suppliers}')
|
||||
av.val_str(comment, 'comment', _m)
|
||||
|
||||
guid = Helper_DB_MySQL.create_guid_str()
|
||||
@@ -101,22 +102,22 @@ class DataStore_Store_Supplier(DataStore_Store_Base):
|
||||
row = Supplier_Temp.from_supplier(supplier)
|
||||
row.guid = guid
|
||||
rows.append(row)
|
||||
print(f'rows: {rows}')
|
||||
Helper_App.console_log(f'rows: {rows}')
|
||||
|
||||
DataStore_Store_Base.upload_bulk(Supplier_Temp.__tablename__, rows, 1000)
|
||||
print('bulk uploaded suppliers')
|
||||
Helper_App.console_log('bulk uploaded suppliers')
|
||||
|
||||
rows = []
|
||||
for supplier in suppliers:
|
||||
print(f'supplier: {supplier}')
|
||||
Helper_App.console_log(f'supplier: {supplier}')
|
||||
for supplier_address in supplier.addresses:
|
||||
row = Supplier_Address_Temp.from_supplier_address(supplier_address)
|
||||
row.guid = guid
|
||||
rows.append(row)
|
||||
print(f'rows: {rows}')
|
||||
Helper_App.console_log(f'rows: {rows}')
|
||||
|
||||
DataStore_Store_Base.upload_bulk(Supplier_Address_Temp.__tablename__, rows, 1000)
|
||||
print('bulk uploaded supplier addresses')
|
||||
Helper_App.console_log('bulk uploaded supplier addresses')
|
||||
|
||||
argument_dict_list = {
|
||||
'a_comment': comment,
|
||||
@@ -125,18 +126,18 @@ class DataStore_Store_Supplier(DataStore_Store_Base):
|
||||
'a_debug': 0
|
||||
}
|
||||
result = cls.db_procedure_execute('p_shop_save_supplier', argument_dict_list)
|
||||
print('saved suppliers')
|
||||
Helper_App.console_log('saved suppliers')
|
||||
|
||||
# Errors
|
||||
cursor = result.cursor
|
||||
cursor.nextset()
|
||||
result_set_e = cursor.fetchall()
|
||||
print(f'raw errors: {result_set_e}')
|
||||
Helper_App.console_log(f'raw errors: {result_set_e}')
|
||||
errors = []
|
||||
if len(result_set_e) > 0:
|
||||
errors = [SQL_Error.from_DB_record(row) for row in result_set_e] # (row[0], row[1])
|
||||
for error in errors:
|
||||
print(f"Error [{error.code}]: {error.msg}")
|
||||
Helper_App.console_log(f"Error [{error.code}]: {error.msg}")
|
||||
|
||||
DataStore_Store_Supplier.db_cursor_clear(cursor)
|
||||
return errors
|
||||
|
||||
@@ -16,6 +16,7 @@ import lib.argument_validation as av
|
||||
from business_objects.sql_error import SQL_Error
|
||||
from business_objects.store.supplier_purchase_order import Supplier_Purchase_Order, Supplier_Purchase_Order_Product_Link, Parameters_Supplier_Purchase_Order, Supplier_Purchase_Order_Temp, Supplier_Purchase_Order_Product_Link_Temp
|
||||
from datastores.datastore_store_base import DataStore_Store_Base
|
||||
from helpers.helper_app import Helper_App
|
||||
from helpers.helper_db_mysql import Helper_DB_MySQL
|
||||
from extensions import db
|
||||
# external
|
||||
@@ -45,15 +46,15 @@ class DataStore_Store_Supplier_Purchase_Order(DataStore_Store_Base):
|
||||
, **argument_dict
|
||||
, 'a_debug': 0
|
||||
}
|
||||
print(f'argument_dict: {argument_dict}')
|
||||
print('executing p_shop_get_many_supplier_purchase_order')
|
||||
Helper_App.console_log(f'argument_dict: {argument_dict}')
|
||||
Helper_App.console_log('executing p_shop_get_many_supplier_purchase_order')
|
||||
result = self.db_procedure_execute('p_shop_get_many_supplier_purchase_order', argument_dict)
|
||||
cursor = result.cursor
|
||||
print('data received')
|
||||
Helper_App.console_log('data received')
|
||||
|
||||
# Supplier_Purchase_Orders
|
||||
result_set_1 = cursor.fetchall()
|
||||
print(f'raw supplier_purchase_orders: {result_set_1}')
|
||||
Helper_App.console_log(f'raw supplier_purchase_orders: {result_set_1}')
|
||||
supplier_purchase_orders = []
|
||||
indices_supplier_purchase_order = {}
|
||||
for row in result_set_1:
|
||||
@@ -64,7 +65,7 @@ class DataStore_Store_Supplier_Purchase_Order(DataStore_Store_Base):
|
||||
# Supplier_Purchase_Orders Items
|
||||
cursor.nextset()
|
||||
result_set_2 = cursor.fetchall()
|
||||
print(f'raw supplier_purchase_order_product_links: {result_set_2}')
|
||||
Helper_App.console_log(f'raw supplier_purchase_order_product_links: {result_set_2}')
|
||||
order_product_links = []
|
||||
for row in result_set_2:
|
||||
new_link = Supplier_Purchase_Order_Product_Link.from_DB_supplier_purchase_order(row)
|
||||
@@ -75,12 +76,12 @@ class DataStore_Store_Supplier_Purchase_Order(DataStore_Store_Base):
|
||||
# Errors
|
||||
cursor.nextset()
|
||||
result_set_e = cursor.fetchall()
|
||||
print(f'raw errors: {result_set_e}')
|
||||
Helper_App.console_log(f'raw errors: {result_set_e}')
|
||||
errors = []
|
||||
if len(result_set_e) > 0:
|
||||
errors = [SQL_Error.from_DB_record(row) for row in result_set_e] # (row[0], row[1])
|
||||
for error in errors:
|
||||
print(f"Error [{error.code}]: {error.msg}")
|
||||
Helper_App.console_log(f"Error [{error.code}]: {error.msg}")
|
||||
|
||||
DataStore_Store_Supplier_Purchase_Order.db_cursor_clear(cursor)
|
||||
|
||||
@@ -99,9 +100,9 @@ class DataStore_Store_Supplier_Purchase_Order(DataStore_Store_Base):
|
||||
row = Supplier_Purchase_Order_Temp.from_supplier_purchase_order(supplier_purchase_order)
|
||||
row.guid = guid
|
||||
rows_order.append(row)
|
||||
print(f'order rows: {rows_order}')
|
||||
Helper_App.console_log(f'order rows: {rows_order}')
|
||||
DataStore_Store_Base.upload_bulk(Supplier_Purchase_Order_Temp.__tablename__, rows_order, 1000)
|
||||
print('bulk uploaded orders')
|
||||
Helper_App.console_log('bulk uploaded orders')
|
||||
|
||||
rows_link = []
|
||||
for supplier_purchase_order in supplier_purchase_orders:
|
||||
@@ -109,9 +110,9 @@ class DataStore_Store_Supplier_Purchase_Order(DataStore_Store_Base):
|
||||
row = Supplier_Purchase_Order_Product_Link_Temp.from_supplier_purchase_order_product_link(link)
|
||||
row.guid = guid
|
||||
rows_link.append(row)
|
||||
print(f'link rows: {rows_link}')
|
||||
Helper_App.console_log(f'link rows: {rows_link}')
|
||||
DataStore_Store_Base.upload_bulk(Supplier_Purchase_Order_Product_Link_Temp.__tablename__, rows_link, 1000)
|
||||
print('bulk uploaded links')
|
||||
Helper_App.console_log('bulk uploaded links')
|
||||
|
||||
argument_dict_list = {
|
||||
'a_comment': comment,
|
||||
@@ -120,13 +121,13 @@ class DataStore_Store_Supplier_Purchase_Order(DataStore_Store_Base):
|
||||
'a_debug': 0
|
||||
}
|
||||
result = cls.db_procedure_execute('p_shop_save_supplier_purchase_order', argument_dict_list)
|
||||
print('saved supplier purchase orders')
|
||||
Helper_App.console_log('saved supplier purchase orders')
|
||||
|
||||
# Errors
|
||||
cursor = result.cursor
|
||||
cursor.nextset()
|
||||
result_set_e = cursor.fetchall()
|
||||
print(f'raw errors: {result_set_e}')
|
||||
Helper_App.console_log(f'raw errors: {result_set_e}')
|
||||
errors = []
|
||||
warnings = []
|
||||
if len(result_set_e) > 0:
|
||||
@@ -136,7 +137,7 @@ class DataStore_Store_Supplier_Purchase_Order(DataStore_Store_Base):
|
||||
warnings.append(new_error)
|
||||
else:
|
||||
errors.append(new_error)
|
||||
print(f"Error [{new_error.code}]: {new_error.msg}")
|
||||
Helper_App.console_log(f"Error [{new_error.code}]: {new_error.msg}")
|
||||
|
||||
cls.db_cursor_clear(cursor)
|
||||
return errors, warnings
|
||||
|
||||
@@ -17,6 +17,7 @@ from business_objects.sql_error import SQL_Error
|
||||
from business_objects.store.stock_item import Stock_Item
|
||||
from business_objects.user import User, User_Filters, User_Permission_Evaluation
|
||||
from datastores.datastore_base import DataStore_Base
|
||||
from helpers.helper_app import Helper_App
|
||||
from helpers.helper_db_mysql import Helper_DB_MySQL
|
||||
# from models.model_view_store_checkout import Model_View_Store_Checkout # circular!
|
||||
from extensions import db
|
||||
@@ -57,16 +58,16 @@ class DataStore_User(DataStore_Base):
|
||||
cursor = result.cursor
|
||||
|
||||
result_set_1 = cursor.fetchall()
|
||||
print(f'raw user data: {result_set_1}')
|
||||
Helper_App.console_log(f'raw user data: {result_set_1}')
|
||||
|
||||
# Errors
|
||||
cursor.nextset()
|
||||
result_set_e = cursor.fetchall()
|
||||
print(f'raw errors: {result_set_e}')
|
||||
Helper_App.console_log(f'raw errors: {result_set_e}')
|
||||
if len(result_set_e) > 0:
|
||||
errors = [SQL_Error.from_DB_record(row) for row in result_set_e] # [SQL_Error(row[0], row[1]) for row in result_set_2]
|
||||
for error in errors:
|
||||
print(f"Error [{error.code}]: {error.msg}")
|
||||
Helper_App.console_log(f"Error [{error.code}]: {error.msg}")
|
||||
|
||||
DataStore_User.db_cursor_clear(cursor)
|
||||
|
||||
@@ -85,10 +86,10 @@ class DataStore_User(DataStore_Base):
|
||||
'a_id_checkout_session': id_checkout_session
|
||||
}
|
||||
|
||||
print('executing p_shop_get_many_user_order')
|
||||
Helper_App.console_log('executing p_shop_get_many_user_order')
|
||||
result = self.db_procedure_execute('p_shop_get_many_user_order', argument_dict_list)
|
||||
cursor = result.cursor
|
||||
print('data received')
|
||||
Helper_App.console_log('data received')
|
||||
|
||||
|
||||
# Discount Delivery Regions
|
||||
@@ -98,16 +99,16 @@ class DataStore_User(DataStore_Base):
|
||||
for row in result_set_1:
|
||||
new_order = Order(row[0], row[1], row[2], row[3], row[4], row[5], row[6])
|
||||
orders.append(new_order)
|
||||
print(f'orders: {orders}')
|
||||
Helper_App.console_log(f'orders: {orders}')
|
||||
|
||||
# Errors
|
||||
cursor.nextset()
|
||||
result_set_e = cursor.fetchall()
|
||||
print(f'raw errors: {result_set_e}')
|
||||
Helper_App.console_log(f'raw errors: {result_set_e}')
|
||||
if len(result_set_e) > 0:
|
||||
errors = [SQL_Error.from_DB_record(row) for row in result_set_e] # [SQL_Error(row[0], row[1]) for row in result_set_e]
|
||||
for error in errors:
|
||||
print(f"Error [{error.code}]: {error.msg}")
|
||||
Helper_App.console_log(f"Error [{error.code}]: {error.msg}")
|
||||
|
||||
DataStore_User.db_cursor_clear(cursor)
|
||||
|
||||
@@ -116,7 +117,7 @@ class DataStore_User(DataStore_Base):
|
||||
|
||||
def get_many_user(self, user_filters, user=None):
|
||||
_m = 'DataStore_User.get_many_user'
|
||||
print(_m)
|
||||
Helper_App.console_log(_m)
|
||||
# av.val_str(user_filters, 'user_filters', _m)
|
||||
# av.val_list(permutations, 'list_permutations', _m, Product_Permutation, 1)
|
||||
av.val_instance(user_filters, 'user_filters', _m, User_Filters)
|
||||
@@ -150,33 +151,33 @@ class DataStore_User(DataStore_Base):
|
||||
"""
|
||||
cursor = result.cursor
|
||||
result_set = cursor.fetchall()
|
||||
print(f'raw users: {result_set}')
|
||||
print(f'type result set: {str(type(result_set))}')
|
||||
print(f'len result set: {len(result_set)}')
|
||||
Helper_App.console_log(f'raw users: {result_set}')
|
||||
Helper_App.console_log(f'type result set: {str(type(result_set))}')
|
||||
Helper_App.console_log(f'len result set: {len(result_set)}')
|
||||
"""
|
||||
user_permission_evals = []
|
||||
for row in result_set:
|
||||
user_permission_eval = User_Permission_Evaluation.from_DB_user_eval(row)
|
||||
user_permission_evals.append(user_permission_eval)
|
||||
print(f'user_permission_evals: {user_permission_evals}')
|
||||
Helper_App.console_log(f'user_permission_evals: {user_permission_evals}')
|
||||
"""
|
||||
users = []
|
||||
if len(result_set) > 0:
|
||||
for row in result_set:
|
||||
print(f'row: {row}')
|
||||
Helper_App.console_log(f'row: {row}')
|
||||
user = User.from_DB_user(row)
|
||||
users.append(user)
|
||||
print(f'user {str(type(user))}: {user}')
|
||||
print(f'type users: {str(type(users))}\n type user 0: {str(type(None if len(users) == 0 else users[0]))}')
|
||||
Helper_App.console_log(f'user {str(type(user))}: {user}')
|
||||
Helper_App.console_log(f'type users: {str(type(users))}\n type user 0: {str(type(None if len(users) == 0 else users[0]))}')
|
||||
# error_list, cursor = self.get_error_list_from_cursor(cursor)
|
||||
errors = []
|
||||
cursor.nextset()
|
||||
result_set_e = cursor.fetchall()
|
||||
print(f'raw errors: {result_set_e}')
|
||||
Helper_App.console_log(f'raw errors: {result_set_e}')
|
||||
if len(result_set_e) > 0:
|
||||
errors = [SQL_Error.from_DB_record(row) for row in result_set_e] # [SQL_Error(row[0], row[1]) for row in result_set_e]
|
||||
for error in errors:
|
||||
print(f"Error [{error.code}]: {error.msg}")
|
||||
Helper_App.console_log(f"Error [{error.code}]: {error.msg}")
|
||||
|
||||
DataStore_User.db_cursor_clear(cursor)
|
||||
|
||||
@@ -184,7 +185,7 @@ class DataStore_User(DataStore_Base):
|
||||
|
||||
def get_many_user(self, user_filters, user=None):
|
||||
_m = 'DataStore_User.get_many_user'
|
||||
print(_m)
|
||||
Helper_App.console_log(_m)
|
||||
# av.val_str(user_filters, 'user_filters', _m)
|
||||
# av.val_list(permutations, 'list_permutations', _m, Product_Permutation, 1)
|
||||
av.val_instance(user_filters, 'user_filters', _m, User_Filters)
|
||||
@@ -218,33 +219,33 @@ class DataStore_User(DataStore_Base):
|
||||
"""
|
||||
cursor = result.cursor
|
||||
result_set = cursor.fetchall()
|
||||
print(f'raw users: {result_set}')
|
||||
print(f'type result set: {str(type(result_set))}')
|
||||
print(f'len result set: {len(result_set)}')
|
||||
Helper_App.console_log(f'raw users: {result_set}')
|
||||
Helper_App.console_log(f'type result set: {str(type(result_set))}')
|
||||
Helper_App.console_log(f'len result set: {len(result_set)}')
|
||||
"""
|
||||
user_permission_evals = []
|
||||
for row in result_set:
|
||||
user_permission_eval = User_Permission_Evaluation.from_DB_user_eval(row)
|
||||
user_permission_evals.append(user_permission_eval)
|
||||
print(f'user_permission_evals: {user_permission_evals}')
|
||||
Helper_App.console_log(f'user_permission_evals: {user_permission_evals}')
|
||||
"""
|
||||
users = []
|
||||
if len(result_set) > 0:
|
||||
for row in result_set:
|
||||
print(f'row: {row}')
|
||||
Helper_App.console_log(f'row: {row}')
|
||||
user = User.from_DB_user(row)
|
||||
users.append(user)
|
||||
print(f'user {str(type(user))}: {user}')
|
||||
print(f'type users: {str(type(users))}\n type user 0: {str(type(None if len(users) == 0 else users[0]))}')
|
||||
Helper_App.console_log(f'user {str(type(user))}: {user}')
|
||||
Helper_App.console_log(f'type users: {str(type(users))}\n type user 0: {str(type(None if len(users) == 0 else users[0]))}')
|
||||
# error_list, cursor = self.get_error_list_from_cursor(cursor)
|
||||
errors = []
|
||||
cursor.nextset()
|
||||
result_set_e = cursor.fetchall()
|
||||
print(f'raw errors: {result_set_e}')
|
||||
Helper_App.console_log(f'raw errors: {result_set_e}')
|
||||
if len(result_set_e) > 0:
|
||||
errors = [SQL_Error.from_DB_record(row) for row in result_set_e] # [SQL_Error(row[0], row[1]) for row in result_set_e]
|
||||
for error in errors:
|
||||
print(f"Error [{error.code}]: {error.msg}")
|
||||
Helper_App.console_log(f"Error [{error.code}]: {error.msg}")
|
||||
|
||||
DataStore_User.db_cursor_clear(cursor)
|
||||
|
||||
|
||||
Binary file not shown.
@@ -11,7 +11,7 @@ Feature: App Helper
|
||||
|
||||
# external
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
# from flask import Flask, render_template, jsonify, request, render_template_string, send_from_directory, redirect, url_for, session
|
||||
from flask import current_app
|
||||
# from flask_sqlalchemy import SQLAlchemy
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ class Helper_App(BaseModel):
|
||||
|
||||
@staticmethod
|
||||
def get_request_data(request):
|
||||
print(f'request={request}')
|
||||
Helper_App.console_log(f'request={request}')
|
||||
data = {}
|
||||
try:
|
||||
data = request.json
|
||||
@@ -31,5 +31,10 @@ class Helper_App(BaseModel):
|
||||
data = request.form
|
||||
except:
|
||||
pass
|
||||
print(f'data={data}')
|
||||
return data
|
||||
Helper_App.console_log(f'data={data}')
|
||||
return data
|
||||
|
||||
@staticmethod
|
||||
def console_log(message):
|
||||
if current_app.config["DEBUG"]:
|
||||
print(message)
|
||||
Binary file not shown.
@@ -7,24 +7,7 @@ Created on Thu Apr 27 12:33:59 2023
|
||||
Argument Validation
|
||||
"""
|
||||
|
||||
# CLASSES
|
||||
# ATTRIBUTE DECLARATION
|
||||
# METHODS
|
||||
# FUNCTION
|
||||
# ARGUMENTS
|
||||
# ARGUMENT VALIDATION
|
||||
# ATTRIBUTE + VARIABLE INSTANTIATION
|
||||
# METHODS
|
||||
# RETURNS
|
||||
|
||||
# NORMAL METHODS
|
||||
# FUNCTION
|
||||
# ARGUMENTS
|
||||
# ARGUMENT VALIDATION
|
||||
# VARIABLE INSTANTIATION
|
||||
# METHODS
|
||||
# RETURNS
|
||||
|
||||
from helpers.helper_app import Helper_App
|
||||
from typing import Optional
|
||||
|
||||
def error_msg_str(v, v_name, method, v_type, suppress_errors = False, suppress_console_outputs = False, v_arg_type = 'argument'):
|
||||
@@ -454,7 +437,7 @@ def input_bool(v_input, v_name, method, suppress_errors = False, suppress_consol
|
||||
val_bool(suppress_errors, 'suppress_errors', my_f)
|
||||
# suppress_console_outputs
|
||||
if not val_bool(suppress_console_outputs, 'suppress_console_outputs', my_f, suppress_errors):
|
||||
print(error_msg_str(suppress_console_outputs, 'suppress_console_outputs', my_f, "<class 'bool'>", suppress_errors))
|
||||
Helper_App.console_log(error_msg_str(suppress_console_outputs, 'suppress_console_outputs', my_f, "<class 'bool'>", suppress_errors))
|
||||
return None
|
||||
# v_name
|
||||
if not val_str(v_name, 'v_name', my_f, 1, -1, suppress_errors, suppress_console_outputs): return None
|
||||
@@ -510,7 +493,7 @@ def full_val_bool(v_input, v_name, method, suppress_errors = False, suppress_con
|
||||
my_f = 'full_val_bool'
|
||||
val_bool(suppress_errors, 'suppress_errors', my_f)
|
||||
if not val_bool(suppress_console_outputs, 'suppress_console_outputs', my_f, suppress_errors):
|
||||
print(error_msg_str(suppress_console_outputs, 'suppress_console_outputs', my_f, "<class 'bool'>", suppress_errors))
|
||||
Helper_App.console_log(error_msg_str(suppress_console_outputs, 'suppress_console_outputs', my_f, "<class 'bool'>", suppress_errors))
|
||||
return False
|
||||
# method
|
||||
if not val_str(method, 'method', my_f, 1, -1, suppress_errors, suppress_console_outputs): return False
|
||||
@@ -539,7 +522,7 @@ def input_int(v_input, v_name, method, v_min = None, v_max = None, suppress_erro
|
||||
my_f = 'input_int'
|
||||
val_bool(suppress_errors, 'suppress_errors', my_f)
|
||||
if not val_bool(suppress_console_outputs, 'suppress_console_outputs', my_f, suppress_errors):
|
||||
print(error_msg_str(suppress_console_outputs, 'suppress_console_outputs', my_f, "<class 'bool'>", suppress_errors))
|
||||
Helper_App.console_log(error_msg_str(suppress_console_outputs, 'suppress_console_outputs', my_f, "<class 'bool'>", suppress_errors))
|
||||
return None
|
||||
# method
|
||||
if not val_str(method, 'method', my_f, 1, -1, suppress_errors, suppress_console_outputs): return None
|
||||
@@ -564,20 +547,20 @@ def input_int(v_input, v_name, method, v_min = None, v_max = None, suppress_erro
|
||||
except:
|
||||
if suppress_errors:
|
||||
if not suppress_console_outputs:
|
||||
print(error_msg)
|
||||
Helper_App.console_log(error_msg)
|
||||
return None
|
||||
int(v_input)
|
||||
if not str(type(v_min)) == "<class 'NoneType'>":
|
||||
if my_int < v_min:
|
||||
if suppress_errors:
|
||||
if not suppress_console_outputs:
|
||||
print(f"{error_msg}\nInt input less than minimum value. Value = {v_input}, minimum = {v_min}.")
|
||||
Helper_App.console_log(f"{error_msg}\nInt input less than minimum value. Value = {v_input}, minimum = {v_min}.")
|
||||
return None
|
||||
if not str(type(v_max)) == "<class 'NoneType'>":
|
||||
if my_int > v_max:
|
||||
if suppress_errors:
|
||||
if not suppress_console_outputs:
|
||||
print(f"{error_msg}\nInt input greater than maximum value. Value = {v_input}, maximum = {v_max}.")
|
||||
Helper_App.console_log(f"{error_msg}\nInt input greater than maximum value. Value = {v_input}, maximum = {v_max}.")
|
||||
return None
|
||||
# RETURNS
|
||||
return my_int
|
||||
@@ -599,7 +582,7 @@ def full_val_int(v_input, v_name, method, v_min = None, v_max = None, suppress_e
|
||||
my_f = 'full_val_int'
|
||||
val_bool(suppress_errors, 'suppress_errors', my_f)
|
||||
if not val_bool(suppress_console_outputs, 'suppress_console_outputs', my_f, suppress_errors):
|
||||
print(error_msg_str(suppress_console_outputs, 'suppress_console_outputs', my_f, "<class 'bool'>", suppress_errors))
|
||||
Helper_App.console_log(error_msg_str(suppress_console_outputs, 'suppress_console_outputs', my_f, "<class 'bool'>", suppress_errors))
|
||||
return False
|
||||
# v_name
|
||||
if not val_str(v_name, 'v_name', my_f, 1, -1, suppress_errors, suppress_console_outputs): return False
|
||||
@@ -633,7 +616,7 @@ def input_float(v_input, v_name, method, v_min = None, v_max = None, suppress_er
|
||||
my_f = 'input_float'
|
||||
val_bool(suppress_errors, 'suppress_errors', my_f)
|
||||
if not val_bool(suppress_console_outputs, 'suppress_console_outputs', my_f, suppress_errors):
|
||||
print(error_msg_str(suppress_console_outputs, 'suppress_console_outputs', my_f, "<class 'bool'>", suppress_errors))
|
||||
Helper_App.console_log(error_msg_str(suppress_console_outputs, 'suppress_console_outputs', my_f, "<class 'bool'>", suppress_errors))
|
||||
return None
|
||||
# method
|
||||
if not val_str(method, 'method', my_f, 1, -1, suppress_errors, suppress_console_outputs): return None
|
||||
@@ -658,20 +641,20 @@ def input_float(v_input, v_name, method, v_min = None, v_max = None, suppress_er
|
||||
except:
|
||||
if suppress_errors:
|
||||
if not suppress_console_outputs:
|
||||
print(error_msg)
|
||||
Helper_App.console_log(error_msg)
|
||||
return None
|
||||
float(v_input)
|
||||
if not str(type(v_min)) == "<class 'NoneType'>":
|
||||
if v_input < v_min:
|
||||
if suppress_errors:
|
||||
if not suppress_console_outputs:
|
||||
print(f"{error_msg}\nInt input less than minimum value. Value = {v_input}, minimum = {v_min}.")
|
||||
Helper_App.console_log(f"{error_msg}\nInt input less than minimum value. Value = {v_input}, minimum = {v_min}.")
|
||||
return None
|
||||
if not str(type(v_max)) == "<class 'NoneType'>":
|
||||
if v_input > v_max:
|
||||
if suppress_errors:
|
||||
if not suppress_console_outputs:
|
||||
print(f"{error_msg}\nInt input greater than maximum value. Value = {v_input}, maximum = {v_max}.")
|
||||
Helper_App.console_log(f"{error_msg}\nInt input greater than maximum value. Value = {v_input}, maximum = {v_max}.")
|
||||
return None
|
||||
# RETURNS
|
||||
return my_float
|
||||
@@ -692,7 +675,7 @@ def full_val_float(v_input, v_name, method, v_min = None, v_max = None, suppress
|
||||
my_f = 'full_val_float'
|
||||
val_bool(suppress_errors, 'suppress_errors', my_f)
|
||||
if not val_bool(suppress_console_outputs, 'suppress_console_outputs', my_f, suppress_errors):
|
||||
print(error_msg_str(suppress_console_outputs, 'suppress_console_outputs', my_f, "<class 'bool'>", suppress_errors))
|
||||
Helper_App.console_log(error_msg_str(suppress_console_outputs, 'suppress_console_outputs', my_f, "<class 'bool'>", suppress_errors))
|
||||
return False
|
||||
# method
|
||||
if not val_str(method, 'method', my_f, 1, -1, suppress_errors, suppress_console_outputs): return False
|
||||
@@ -746,7 +729,7 @@ def val_type(v_input, v_name, method, v_type, suppress_errors = False, suppress_
|
||||
my_f = 'val_type'
|
||||
val_bool(suppress_errors, 'suppress_errors', my_f)
|
||||
if not val_bool(suppress_console_outputs, 'suppress_console_outputs', my_f, suppress_errors):
|
||||
print(error_msg_str(suppress_console_outputs, 'suppress_console_outputs', my_f, "<class 'bool'>", suppress_errors))
|
||||
Helper_App.console_log(error_msg_str(suppress_console_outputs, 'suppress_console_outputs', my_f, "<class 'bool'>", suppress_errors))
|
||||
return False
|
||||
# method
|
||||
if not val_str(method, 'method', my_f, 1, -1, suppress_errors, suppress_console_outputs): return False
|
||||
@@ -765,7 +748,7 @@ def val_type(v_input, v_name, method, v_type, suppress_errors = False, suppress_
|
||||
if not mytype == v_type: # f"<class '{v_type}'>":
|
||||
if suppress_errors:
|
||||
if not suppress_console_outputs:
|
||||
print(error_message)
|
||||
Helper_App.console_log(error_message)
|
||||
return False
|
||||
raise ValueError(error_message)
|
||||
# RETURNS
|
||||
@@ -787,7 +770,7 @@ def val_instance(v_input, v_name, method, v_type, suppress_errors = False, suppr
|
||||
my_f = 'val_type'
|
||||
val_bool(suppress_errors, 'suppress_errors', my_f)
|
||||
if not val_bool(suppress_console_outputs, 'suppress_console_outputs', my_f, suppress_errors):
|
||||
print(error_msg_str(suppress_console_outputs, 'suppress_console_outputs', my_f, "<class 'bool'>", suppress_errors))
|
||||
Helper_App.console_log(error_msg_str(suppress_console_outputs, 'suppress_console_outputs', my_f, "<class 'bool'>", suppress_errors))
|
||||
return False
|
||||
# method
|
||||
if not val_str(method, 'method', my_f, 1, -1, suppress_errors, suppress_console_outputs): return False
|
||||
@@ -801,7 +784,7 @@ def val_instance(v_input, v_name, method, v_type, suppress_errors = False, suppr
|
||||
if not isinstance(v_type, type): # mytype == v_type: # f"<class '{v_type}'>":
|
||||
if suppress_errors:
|
||||
if not suppress_console_outputs:
|
||||
print(error_message)
|
||||
Helper_App.console_log(error_message)
|
||||
return False
|
||||
raise ValueError(error_message) # val_str(v_type, 'v_type', my_f, 6, -1, suppress_errors, suppress_console_outputs): return False
|
||||
# v_input
|
||||
@@ -811,7 +794,7 @@ def val_instance(v_input, v_name, method, v_type, suppress_errors = False, suppr
|
||||
if not isinstance(v_input, v_type): # mytype == v_type: # f"<class '{v_type}'>":
|
||||
if suppress_errors:
|
||||
if not suppress_console_outputs:
|
||||
print(error_message)
|
||||
Helper_App.console_log(error_message)
|
||||
return False
|
||||
raise ValueError(error_message)
|
||||
# RETURNS
|
||||
@@ -836,7 +819,7 @@ def val_list(v_input, v_name, method, v_type = '', min_len = -1, max_len = -1, s
|
||||
my_f = 'val_list'
|
||||
val_bool(suppress_errors, 'suppress_errors', my_f)
|
||||
if not val_bool(suppress_console_outputs, 'suppress_console_outputs', my_f, suppress_errors):
|
||||
print(error_msg_str(suppress_console_outputs, 'suppress_console_outputs', my_f, "<class 'bool'>", suppress_errors))
|
||||
Helper_App.console_log(error_msg_str(suppress_console_outputs, 'suppress_console_outputs', my_f, "<class 'bool'>", suppress_errors))
|
||||
return False
|
||||
# method
|
||||
if not val_str(method, 'method', my_f, 1, -1, suppress_errors, suppress_console_outputs): return False
|
||||
@@ -865,20 +848,20 @@ def val_list(v_input, v_name, method, v_type = '', min_len = -1, max_len = -1, s
|
||||
if not str(type(v_input)) == "<class 'list'>":
|
||||
if suppress_errors:
|
||||
if not suppress_console_outputs:
|
||||
print(error_msg)
|
||||
Helper_App.console_log(error_msg)
|
||||
return False
|
||||
raise ValueError(error_msg)
|
||||
L = len(v_input)
|
||||
if max_len > -1 and L > max_len:
|
||||
if suppress_errors:
|
||||
if not suppress_console_outputs:
|
||||
print(error_msg + f'\nInvalid list length. Maximum = {max_len}, length = {L}')
|
||||
Helper_App.console_log(error_msg + f'\nInvalid list length. Maximum = {max_len}, length = {L}')
|
||||
return False
|
||||
raise ValueError(error_msg + f'\nInvalid list length. Maximum = {max_len}, length = {L}')
|
||||
if L < min_len:
|
||||
if suppress_errors:
|
||||
if not suppress_console_outputs:
|
||||
print(error_msg + f"Invalid list length. Minimum = {min_len}, length = {L}")
|
||||
Helper_App.console_log(error_msg + f"Invalid list length. Minimum = {min_len}, length = {L}")
|
||||
return False
|
||||
raise ValueError(error_msg + f'\nInvalid list length. Minimum = {min_len}, length = {L}')
|
||||
if v_type != '' and L > 0:
|
||||
@@ -888,7 +871,7 @@ def val_list(v_input, v_name, method, v_type = '', min_len = -1, max_len = -1, s
|
||||
error_msg = error_msg + '\n' + error_msg_str(v_input[i], f'{v_name}[{i}]', my_f, v_type, False, False, 'list element')
|
||||
if suppress_errors:
|
||||
if not suppress_console_outputs:
|
||||
print(error_msg)
|
||||
Helper_App.console_log(error_msg)
|
||||
return False
|
||||
raise ValueError(error_msg)
|
||||
# RETURNS
|
||||
@@ -913,7 +896,7 @@ def val_list_instances(v_input, v_name, method, v_type = None, min_len = -1, max
|
||||
my_f = 'val_list_instances'
|
||||
val_bool(suppress_errors, 'suppress_errors', my_f)
|
||||
if not val_bool(suppress_console_outputs, 'suppress_console_outputs', my_f, suppress_errors):
|
||||
print(error_msg_str(suppress_console_outputs, 'suppress_console_outputs', my_f, "<class 'bool'>", suppress_errors))
|
||||
Helper_App.console_log(error_msg_str(suppress_console_outputs, 'suppress_console_outputs', my_f, "<class 'bool'>", suppress_errors))
|
||||
return False
|
||||
# method
|
||||
if not val_str(method, 'method', my_f, 1, -1, suppress_errors, suppress_console_outputs): return False
|
||||
@@ -942,20 +925,20 @@ def val_list_instances(v_input, v_name, method, v_type = None, min_len = -1, max
|
||||
if not str(type(v_input)) == "<class 'list'>":
|
||||
if suppress_errors:
|
||||
if not suppress_console_outputs:
|
||||
print(error_msg)
|
||||
Helper_App.console_log(error_msg)
|
||||
return False
|
||||
raise ValueError(error_msg)
|
||||
L = len(v_input)
|
||||
if max_len > -1 and L > max_len:
|
||||
if suppress_errors:
|
||||
if not suppress_console_outputs:
|
||||
print(error_msg + f'\nInvalid list length. Maximum = {max_len}, length = {L}')
|
||||
Helper_App.console_log(error_msg + f'\nInvalid list length. Maximum = {max_len}, length = {L}')
|
||||
return False
|
||||
raise ValueError(error_msg + f'\nInvalid list length. Maximum = {max_len}, length = {L}')
|
||||
if L < min_len:
|
||||
if suppress_errors:
|
||||
if not suppress_console_outputs:
|
||||
print(error_msg + f"Invalid list length. Minimum = {min_len}, length = {L}")
|
||||
Helper_App.console_log(error_msg + f"Invalid list length. Minimum = {min_len}, length = {L}")
|
||||
return False
|
||||
raise ValueError(error_msg + f'\nInvalid list length. Minimum = {min_len}, length = {L}')
|
||||
if v_type != '' and L > 0:
|
||||
@@ -965,7 +948,7 @@ def val_list_instances(v_input, v_name, method, v_type = None, min_len = -1, max
|
||||
error_msg = error_msg + '\n' + error_msg_str(v_input[i], f'{v_name}[{i}]', my_f, v_type, False, False, 'list element')
|
||||
if suppress_errors:
|
||||
if not suppress_console_outputs:
|
||||
print(error_msg)
|
||||
Helper_App.console_log(error_msg)
|
||||
return False
|
||||
raise ValueError(error_msg)
|
||||
# RETURNS
|
||||
@@ -995,7 +978,7 @@ def val_nested_list(v_input, v_name, method, depth_i, depth_max, v_type = '', v_
|
||||
my_f = 'val_nested_list'
|
||||
val_bool(suppress_errors, 'suppress_errors', my_f)
|
||||
if not val_bool(suppress_console_outputs, 'suppress_console_outputs', my_f, suppress_errors):
|
||||
print(error_msg_str(suppress_console_outputs, 'suppress_console_outputs', my_f, "<class 'bool'>"))
|
||||
Helper_App.console_log(error_msg_str(suppress_console_outputs, 'suppress_console_outputs', my_f, "<class 'bool'>"))
|
||||
return False
|
||||
# method
|
||||
if not val_str(method, 'method', my_f, 1, -1, suppress_errors, suppress_console_outputs): return False
|
||||
@@ -1015,14 +998,14 @@ def val_nested_list(v_input, v_name, method, depth_i, depth_max, v_type = '', v_
|
||||
if not (val_list(v_mins, 'v_mins', my_f, "<class 'int'>", depth_max + 1, depth_max + 1, True, True) or v_mins == []):
|
||||
error_msg = error_msg_str(v_mins, 'v_mins', my_f, "<class 'int'>")
|
||||
if not suppress_console_outputs:
|
||||
print(error_msg)
|
||||
Helper_App.console_log(error_msg)
|
||||
return False
|
||||
raise ValueError(error_msg)
|
||||
# v_maxs
|
||||
if not (val_list(v_maxs, 'v_maxs', my_f, "<class 'int'>", depth_max + 1, depth_max + 1, True, True) or v_maxs == []):
|
||||
error_msg = error_msg_str(v_maxs, 'v_maxs', my_f, "<class 'int'>")
|
||||
if not suppress_console_outputs:
|
||||
print(error_msg)
|
||||
Helper_App.console_log(error_msg)
|
||||
return False
|
||||
raise ValueError(error_msg)
|
||||
# allow_nuns
|
||||
@@ -1032,7 +1015,7 @@ def val_nested_list(v_input, v_name, method, depth_i, depth_max, v_type = '', v_
|
||||
error_msg = error_msg_str(v_input, v_name, method, mytype, suppress_errors, suppress_console_outputs, v_arg_type)
|
||||
if not val_list(v_input, v_name, method, mytype, v_min, v_max, suppress_errors, suppress_console_outputs, allow_nuns, v_arg_type):
|
||||
if not suppress_console_outputs:
|
||||
print(error_msg)
|
||||
Helper_App.console_log(error_msg)
|
||||
return False
|
||||
# METHODS
|
||||
L = len(v_input)
|
||||
@@ -1040,7 +1023,7 @@ def val_nested_list(v_input, v_name, method, depth_i, depth_max, v_type = '', v_
|
||||
if v_min > -1:
|
||||
if suppress_errors:
|
||||
if not suppress_console_outputs:
|
||||
print(error_msg + f'\nMinimum length {v_min} not met.')
|
||||
Helper_App.console_log(error_msg + f'\nMinimum length {v_min} not met.')
|
||||
return False
|
||||
raise ValueError(error_msg + f'\nMinimum length {v_min} not met.')
|
||||
elif depth_i < depth_max:
|
||||
@@ -1048,22 +1031,22 @@ def val_nested_list(v_input, v_name, method, depth_i, depth_max, v_type = '', v_
|
||||
if not (v_mins == [] or v_maxs == []):
|
||||
if not val_nested_list(v_input[i], v_name, method, depth_i + 1, depth_max, v_type, v_mins[depth_i + 1], v_mins, v_maxs[depth_i + 1], v_maxs, suppress_errors, suppress_console_outputs, v_arg_type):
|
||||
if not suppress_console_outputs:
|
||||
print(error_msg)
|
||||
Helper_App.console_log(error_msg)
|
||||
return False
|
||||
elif not v_mins == []:
|
||||
if not val_nested_list(v_input[i], v_name, method, depth_i + 1, depth_max, v_type, v_mins[depth_i + 1], v_mins, -1, v_maxs, suppress_errors, suppress_console_outputs, v_arg_type):
|
||||
if not suppress_console_outputs:
|
||||
print(error_msg)
|
||||
Helper_App.console_log(error_msg)
|
||||
return False
|
||||
elif not v_maxs == []:
|
||||
if not val_nested_list(v_input[i], v_name, method, depth_i + 1, depth_max, v_type, -1, v_mins, v_maxs[depth_i + 1], v_maxs, suppress_errors, suppress_console_outputs, v_arg_type):
|
||||
if not suppress_console_outputs:
|
||||
print(error_msg)
|
||||
Helper_App.console_log(error_msg)
|
||||
return False
|
||||
else:
|
||||
if not val_nested_list(v_input[i], v_name, method, depth_i + 1, depth_max, v_type, -1, v_mins, -1, v_maxs, suppress_errors, suppress_console_outputs, v_arg_type):
|
||||
if not suppress_console_outputs:
|
||||
print(error_msg)
|
||||
Helper_App.console_log(error_msg)
|
||||
return False
|
||||
# RETURNS
|
||||
return True
|
||||
@@ -1092,7 +1075,7 @@ def val_nested_list_instances(v_input, v_name, method, depth_i, depth_max, v_typ
|
||||
my_f = 'val_nested_list'
|
||||
val_bool(suppress_errors, 'suppress_errors', my_f)
|
||||
if not val_bool(suppress_console_outputs, 'suppress_console_outputs', my_f, suppress_errors):
|
||||
print(error_msg_str(suppress_console_outputs, 'suppress_console_outputs', my_f, "<class 'bool'>"))
|
||||
Helper_App.console_log(error_msg_str(suppress_console_outputs, 'suppress_console_outputs', my_f, "<class 'bool'>"))
|
||||
return False
|
||||
# method
|
||||
if not val_str(method, 'method', my_f, 1, -1, suppress_errors, suppress_console_outputs): return False
|
||||
@@ -1112,14 +1095,14 @@ def val_nested_list_instances(v_input, v_name, method, depth_i, depth_max, v_typ
|
||||
if not (val_list(v_mins, 'v_mins', my_f, "<class 'int'>", depth_max + 1, depth_max + 1, True, True) or v_mins == []):
|
||||
error_msg = error_msg_str(v_mins, 'v_mins', my_f, "<class 'int'>")
|
||||
if not suppress_console_outputs:
|
||||
print(error_msg)
|
||||
Helper_App.console_log(error_msg)
|
||||
return False
|
||||
raise ValueError(error_msg)
|
||||
# v_maxs
|
||||
if not (val_list(v_maxs, 'v_maxs', my_f, "<class 'int'>", depth_max + 1, depth_max + 1, True, True) or v_maxs == []):
|
||||
error_msg = error_msg_str(v_maxs, 'v_maxs', my_f, "<class 'int'>")
|
||||
if not suppress_console_outputs:
|
||||
print(error_msg)
|
||||
Helper_App.console_log(error_msg)
|
||||
return False
|
||||
raise ValueError(error_msg)
|
||||
# allow_nuns
|
||||
@@ -1129,7 +1112,7 @@ def val_nested_list_instances(v_input, v_name, method, depth_i, depth_max, v_typ
|
||||
error_msg = error_msg_str(v_input, v_name, method, mytype, suppress_errors, suppress_console_outputs, v_arg_type)
|
||||
if not val_list_instances(v_input, v_name, method, mytype, v_min, v_max, suppress_errors, suppress_console_outputs, allow_nuns, v_arg_type):
|
||||
if not suppress_console_outputs:
|
||||
print(error_msg)
|
||||
Helper_App.console_log(error_msg)
|
||||
return False
|
||||
# METHODS
|
||||
L = len(v_input)
|
||||
@@ -1137,7 +1120,7 @@ def val_nested_list_instances(v_input, v_name, method, depth_i, depth_max, v_typ
|
||||
if v_min > -1:
|
||||
if suppress_errors:
|
||||
if not suppress_console_outputs:
|
||||
print(error_msg + f'\nMinimum length {v_min} not met.')
|
||||
Helper_App.console_log(error_msg + f'\nMinimum length {v_min} not met.')
|
||||
return False
|
||||
raise ValueError(error_msg + f'\nMinimum length {v_min} not met.')
|
||||
elif depth_i < depth_max:
|
||||
@@ -1145,22 +1128,22 @@ def val_nested_list_instances(v_input, v_name, method, depth_i, depth_max, v_typ
|
||||
if not (v_mins == [] or v_maxs == []):
|
||||
if not val_nested_list(v_input[i], v_name, method, depth_i + 1, depth_max, v_type, v_mins[depth_i + 1], v_mins, v_maxs[depth_i + 1], v_maxs, suppress_errors, suppress_console_outputs, allow_nuns, v_arg_type):
|
||||
if not suppress_console_outputs:
|
||||
print(error_msg)
|
||||
Helper_App.console_log(error_msg)
|
||||
return False
|
||||
elif not v_mins == []:
|
||||
if not val_nested_list(v_input[i], v_name, method, depth_i + 1, depth_max, v_type, v_mins[depth_i + 1], v_mins, -1, v_maxs, suppress_errors, suppress_console_outputs, allow_nuns, v_arg_type):
|
||||
if not suppress_console_outputs:
|
||||
print(error_msg)
|
||||
Helper_App.console_log(error_msg)
|
||||
return False
|
||||
elif not v_maxs == []:
|
||||
if not val_nested_list(v_input[i], v_name, method, depth_i + 1, depth_max, v_type, -1, v_mins, v_maxs[depth_i + 1], v_maxs, suppress_errors, suppress_console_outputs, allow_nuns, v_arg_type):
|
||||
if not suppress_console_outputs:
|
||||
print(error_msg)
|
||||
Helper_App.console_log(error_msg)
|
||||
return False
|
||||
else:
|
||||
if not val_nested_list(v_input[i], v_name, method, depth_i + 1, depth_max, v_type, -1, v_mins, -1, v_maxs, suppress_errors, suppress_console_outputs, allow_nuns, v_arg_type):
|
||||
if not suppress_console_outputs:
|
||||
print(error_msg)
|
||||
Helper_App.console_log(error_msg)
|
||||
return False
|
||||
# RETURNS
|
||||
return True
|
||||
@@ -1183,7 +1166,7 @@ def val_url(v_input, v_name, method, min_len = 12, max_len = -1, suppress_errors
|
||||
v_type = "<class 'str'>"
|
||||
val_bool(suppress_errors, 'suppress_errors', _m)
|
||||
if not val_bool(suppress_console_outputs, 'suppress_console_outputs', _m, suppress_errors):
|
||||
print(error_msg_str(suppress_console_outputs, 'suppress_console_outputs', _m, "<class 'bool'>"))
|
||||
Helper_App.console_log(error_msg_str(suppress_console_outputs, 'suppress_console_outputs', _m, "<class 'bool'>"))
|
||||
return False
|
||||
# method
|
||||
if not val_str(method, 'method', _m, -1, -1, suppress_errors, suppress_console_outputs): return False
|
||||
@@ -1203,7 +1186,7 @@ def val_url(v_input, v_name, method, min_len = 12, max_len = -1, suppress_errors
|
||||
if not (v_input[:8] == r'https://' or v_input[:7] == r'http://'):
|
||||
if suppress_errors:
|
||||
if not suppress_console_outputs:
|
||||
print(error_msg)
|
||||
Helper_App.console_log(error_msg)
|
||||
return False
|
||||
raise ValueError(error_msg)
|
||||
# RETURNS
|
||||
@@ -1243,7 +1226,7 @@ def val_DataFrame(v_input, v_name, method, v_types=[], min_col=-1, max_col=-1, c
|
||||
my_f = 'val_DataFrame'
|
||||
val_bool(suppress_errors, 'suppress_errors', my_f)
|
||||
if not val_bool(suppress_console_outputs, 'suppress_console_outputs', my_f, suppress_errors):
|
||||
print(error_msg_str(suppress_console_outputs, 'suppress_console_outputs', my_f, "<class 'bool'>"))
|
||||
Helper_App.console_log(error_msg_str(suppress_console_outputs, 'suppress_console_outputs', my_f, "<class 'bool'>"))
|
||||
return False
|
||||
# method
|
||||
if not val_str(method, 'method', my_f, 1, -1, suppress_errors, suppress_console_outputs): return False
|
||||
@@ -1264,14 +1247,14 @@ def val_DataFrame(v_input, v_name, method, v_types=[], min_col=-1, max_col=-1, c
|
||||
if not (val_list(v_types, 'v_types', my_f, "<class 'str'>", min_col, max_col, True, True, True) or v_types == []):
|
||||
error_msg = error_msg_str(v_types, 'v_types', my_f, str)
|
||||
if not suppress_console_outputs:
|
||||
print(error_msg)
|
||||
Helper_App.console_log(error_msg)
|
||||
return False
|
||||
raise ValueError(error_msg)
|
||||
# cols
|
||||
if not (val_list(cols, 'cols', my_f, "<class 'str'>", min_col, max_col, True, True) or cols == []):
|
||||
error_msg = error_msg_str(cols, 'cols', my_f, "<class 'str'>")
|
||||
if not suppress_console_outputs:
|
||||
print(error_msg)
|
||||
Helper_App.console_log(error_msg)
|
||||
return False
|
||||
raise ValueError(error_msg)
|
||||
# v_input
|
||||
@@ -1282,14 +1265,14 @@ def val_DataFrame(v_input, v_name, method, v_types=[], min_col=-1, max_col=-1, c
|
||||
if (min_col > 0 and n_c < min_col) or (max_col > 0 and n_c > max_col):
|
||||
if suppress_errors:
|
||||
if not suppress_console_outputs:
|
||||
print(error_msg)
|
||||
Helper_App.console_log(error_msg)
|
||||
return False
|
||||
raise ValueError(error_msg)
|
||||
my_sz = len(v_input.index)
|
||||
if (min_sz > 0 and my_sz < min_sz) or (max_sz > 0 and my_sz > max_sz):
|
||||
if suppress_errors:
|
||||
if not suppress_console_outputs:
|
||||
print(error_msg)
|
||||
Helper_App.console_log(error_msg)
|
||||
return False
|
||||
raise ValueError(error_msg)
|
||||
if not v_types == []:
|
||||
@@ -1297,7 +1280,7 @@ def val_DataFrame(v_input, v_name, method, v_types=[], min_col=-1, max_col=-1, c
|
||||
if not (v_types[col_i] == None or str(type(v_types[col_i])) == "<class 'str'>" and val_type(v_input.at[0, v_input.columns[col_i]], 'v_input.at[0, v_input.columns[col_i]]', my_f, v_types[col_i], True, False) or val_instance(v_input.at[0, v_input.columns[col_i]], 'v_input.at[0, v_input.columns[col_i]]', my_f, v_types[col_i], True, False)): # str(type(v_input[v_input.columns[col_i]][0])) == v_types[col_i] or v_types[col_i] == '':
|
||||
if suppress_errors:
|
||||
if not suppress_console_outputs:
|
||||
print(error_msg + f'\nInvalid data type {str(type(v_input.at[0, v_input.columns[col_i]]))} in column {v_input.columns[col_i]}')
|
||||
Helper_App.console_log(error_msg + f'\nInvalid data type {str(type(v_input.at[0, v_input.columns[col_i]]))} in column {v_input.columns[col_i]}')
|
||||
return False
|
||||
raise ValueError(error_msg + f'\nInvalid data type {str(type(v_input.at[0, v_input.columns[col_i]]))} in column {v_input.columns[col_i]}')
|
||||
if not cols == []:
|
||||
@@ -1305,7 +1288,7 @@ def val_DataFrame(v_input, v_name, method, v_types=[], min_col=-1, max_col=-1, c
|
||||
if not v_input.columns[col_i] == cols[col_i] or cols[col_i] == '':
|
||||
if suppress_errors:
|
||||
if not suppress_console_outputs:
|
||||
print(error_msg + f'\nInvalid column heading for column {v_input.columns[col_i]}')
|
||||
Helper_App.console_log(error_msg + f'\nInvalid column heading for column {v_input.columns[col_i]}')
|
||||
return False
|
||||
raise ValueError(error_msg + f'\nInvalid column heading for column {v_input.columns[col_i]}')
|
||||
# RETURNS
|
||||
@@ -1314,5 +1297,5 @@ def val_DataFrame(v_input, v_name, method, v_types=[], min_col=-1, max_col=-1, c
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
print(input_bool('true', 'input_bool', 'test'))
|
||||
print(input_bool(None, 'input_bool', 'test'))
|
||||
Helper_App.console_log(input_bool('true', 'input_bool', 'test'))
|
||||
Helper_App.console_log(input_bool(None, 'input_bool', 'test'))
|
||||
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.
@@ -11,6 +11,7 @@ Data model for store permutations view
|
||||
"""
|
||||
|
||||
# internal
|
||||
from helpers.helper_app import Helper_App
|
||||
from models.model_view_base import Model_View_Base
|
||||
|
||||
# external
|
||||
@@ -21,5 +22,5 @@ class Model_View_Admin(Model_View_Base):
|
||||
|
||||
def __init__(self, hash_page_current, **kwargs):
|
||||
_m = 'Model_View_Admin.__init__'
|
||||
print(f'{_m}\nstarting')
|
||||
Helper_App.console_log(f'{_m}\nstarting')
|
||||
super().__init__(hash_page_current=hash_page_current, **kwargs)
|
||||
@@ -17,15 +17,16 @@ Base data model for views
|
||||
# IMPORTS
|
||||
# internal
|
||||
# from routes import bp_home
|
||||
import lib.argument_validation as av
|
||||
from forms.forms import Form_Is_Included_VAT, Form_Delivery_Region, Form_Currency
|
||||
from datastores.datastore_base import DataStore_Base
|
||||
from datastores.datastore_user import DataStore_User
|
||||
from business_objects.base import Base
|
||||
from business_objects.store.product_category import Product_Category
|
||||
from forms.access_level import Filters_Access_Level
|
||||
from forms.unit_measurement import Filters_Unit_Measurement
|
||||
from business_objects.user import User, User_Filters
|
||||
from datastores.datastore_base import DataStore_Base
|
||||
from datastores.datastore_user import DataStore_User
|
||||
from forms.access_level import Filters_Access_Level
|
||||
from forms.forms import Form_Is_Included_VAT, Form_Delivery_Region, Form_Currency
|
||||
from forms.unit_measurement import Filters_Unit_Measurement
|
||||
from helpers.helper_app import Helper_App
|
||||
import lib.argument_validation as av
|
||||
# external
|
||||
from abc import ABC, abstractmethod
|
||||
from flask_sqlalchemy import SQLAlchemy
|
||||
@@ -243,7 +244,7 @@ class Model_View_Base(BaseModel, ABC):
|
||||
# Initialiser - validation
|
||||
_m = 'Model_View_Base.__new__'
|
||||
v_arg_type = 'class attribute'
|
||||
print(f'{_m}\nstarting')
|
||||
Helper_App.console_log(f'{_m}\nstarting')
|
||||
# return super().__new__(cls, *args, **kwargs)
|
||||
av.val_instance(db, 'db', _m, SQLAlchemy, v_arg_type=v_arg_type)
|
||||
return super(Model_View_Base, cls).__new__(cls)
|
||||
@@ -253,7 +254,7 @@ class Model_View_Base(BaseModel, ABC):
|
||||
"""
|
||||
_m = 'Model_View_Base.__init__'
|
||||
v_arg_type = 'class attribute'
|
||||
print(f'{_m}\nstarting')
|
||||
Helper_App.console_log(f'{_m}\nstarting')
|
||||
av.val_instance(db, 'db', _m, SQLAlchemy, v_arg_type=v_arg_type)
|
||||
"""
|
||||
BaseModel.__init__(self, hash_page_current=hash_page_current, **kwargs)
|
||||
@@ -261,9 +262,9 @@ class Model_View_Base(BaseModel, ABC):
|
||||
self.db = db
|
||||
self.session = session
|
||||
info_user = self.get_info_user()
|
||||
print(f'info_user: {info_user}\ntype: {str(type(info_user))}')
|
||||
Helper_App.console_log(f'info_user: {info_user}\ntype: {str(type(info_user))}')
|
||||
self.is_user_logged_in = ('sub' in list(info_user.keys()) and not info_user['sub'] == '' and not str(type(info_user['sub'])) == "<class 'NoneType'?")
|
||||
print(f'is_user_logged_in: {self.is_user_logged_in}')
|
||||
Helper_App.console_log(f'is_user_logged_in: {self.is_user_logged_in}')
|
||||
self.id_user = info_user['sub'] if self.is_user_logged_in else ''
|
||||
self.app = app
|
||||
"""
|
||||
@@ -274,12 +275,12 @@ class Model_View_Base(BaseModel, ABC):
|
||||
# self.form_delivery_region = Form_Delivery_Region()
|
||||
# self.form_currency = Form_Currency()
|
||||
self.is_page_store = False
|
||||
print(f'session: {self.session}')
|
||||
Helper_App.console_log(f'session: {self.session}')
|
||||
|
||||
datastore_user = DataStore_User()
|
||||
self.user = datastore_user.get_user_session()
|
||||
self.is_user_logged_in = self.user.is_logged_in
|
||||
print(f'model_view_base init end - model.user: {self.user}')
|
||||
Helper_App.console_log(f'model_view_base init end - model.user: {self.user}')
|
||||
|
||||
def output_bool(self, boolean):
|
||||
return str(boolean).lower()
|
||||
@@ -364,7 +365,7 @@ class Model_View_Base(BaseModel, ABC):
|
||||
if preview_str != '':
|
||||
preview_str += '\n'
|
||||
obj_json = obj.to_json()
|
||||
print(f'obj_json: {obj_json}')
|
||||
Helper_App.console_log(f'obj_json: {obj_json}')
|
||||
preview_str += obj_json[obj_json[Base.FLAG_NAME_ATTR_OPTION_TEXT]]
|
||||
return preview_str
|
||||
@staticmethod
|
||||
|
||||
@@ -29,6 +29,7 @@ from datastores.datastore_store_base import DataStore_Store_Base
|
||||
from datastores.datastore_user import DataStore_User
|
||||
from datastores.datastore_store_basket import DataStore_Store_Basket
|
||||
from forms.forms import Form_Basket_Edit, Form_Is_Included_VAT, Form_Delivery_Region, Form_Currency
|
||||
from helpers.helper_app import Helper_App
|
||||
import lib.argument_validation as av
|
||||
from models.model_view_base import Model_View_Base
|
||||
# external
|
||||
@@ -212,7 +213,7 @@ class Model_View_Store(Model_View_Base):
|
||||
# Initialiser - validation
|
||||
_m = 'Model_View_Store.__new__'
|
||||
v_arg_type = 'class attribute'
|
||||
print(f'{_m}\nstarting')
|
||||
Helper_App.console_log(f'{_m}\nstarting')
|
||||
# av.val_str(id_user, 'id_user', _m)
|
||||
# return super().__new__(cls, *args, **kwargs)
|
||||
# cls.FLAG_BUTTON_BASKET_ADD = cls.FLAG_BUTTON_SUBMIT + '.buttonAddToBasket'
|
||||
@@ -225,7 +226,7 @@ class Model_View_Store(Model_View_Base):
|
||||
def __init__(self, hash_page_current, **kwargs): # , id_currency, id_region_delivery, is_included_VAT):
|
||||
# Constructor
|
||||
_m = 'Model_View_Store.__init__'
|
||||
print(f'{_m}\nstarting')
|
||||
Helper_App.console_log(f'{_m}\nstarting')
|
||||
super().__init__(hash_page_current=hash_page_current, **kwargs)
|
||||
self.is_page_store = True
|
||||
"""
|
||||
@@ -279,7 +280,7 @@ class Model_View_Store(Model_View_Base):
|
||||
|
||||
def get_many_product_image_src(self, product_id, image_ids = '', get_primary_only = True, resolution_level = ''):
|
||||
_m = 'Model_View_Store.get_many_product_image'
|
||||
# print(f'{_m}\n')
|
||||
# Helper_App.console_log(f'{_m}\n')
|
||||
# av.val_instance(filters, 'filters', _m, Product_Image_Filters)
|
||||
av.val_int(product_id, 'product_id', _m)
|
||||
# av.full_val_int(product_id, 'product_id', _m)
|
||||
@@ -324,14 +325,14 @@ class Model_View_Store(Model_View_Base):
|
||||
# av.full_val_int(product_id, 'product_id', _m)
|
||||
# product_id = int(product_id)
|
||||
# av.val_instance(db, 'db', _m, SQLAlchemy)
|
||||
print(f'{_m} starting')
|
||||
# print(f'product_id: {product_id}\npermutation_id: {permutation_id}\nquantity = {quantity}')
|
||||
Helper_App.console_log(f'{_m} starting')
|
||||
# Helper_App.console_log(f'product_id: {product_id}\npermutation_id: {permutation_id}\nquantity = {quantity}')
|
||||
# av.full_val_int(product_id, 'product_id', _m)
|
||||
# print('valid product id')
|
||||
# Helper_App.console_log('valid product id')
|
||||
av.full_val_int(quantity, 'quantity', _m)
|
||||
quantity = int(quantity)
|
||||
# item_added = False
|
||||
print(f'basket: {self.basket}')
|
||||
Helper_App.console_log(f'basket: {self.basket}')
|
||||
ids_permutation, quantities_permutation = self.basket.to_csv()
|
||||
self.basket = DataStore_Store_Basket().edit_basket(ids_permutation, quantities_permutation, permutation_id, quantity, quantity_sum_not_replace, self.id_currency, self.id_region_delivery, self.is_included_VAT)
|
||||
return True
|
||||
@@ -360,14 +361,14 @@ class Model_View_Store(Model_View_Base):
|
||||
permutation_ids += id_permutation # str(basket[b].product.id)
|
||||
# item_index_dict[Basket.get_key_product_index_from_ids_product_permutation(id_product, id_permutation)] = index_item
|
||||
item_index_dict[id_permutation] = index_item
|
||||
print(f'product_ids = {product_ids}')
|
||||
print(f'permutation_ids = {permutation_ids}')
|
||||
Helper_App.console_log(f'product_ids = {product_ids}')
|
||||
Helper_App.console_log(f'permutation_ids = {permutation_ids}')
|
||||
return product_ids, permutation_ids, item_index_dict
|
||||
|
||||
def _get_basket_from_json(self, json_data):
|
||||
basket = json_data[self.KEY_BASKET]['items']
|
||||
av.val_instance(basket, 'basket', 'Model_View_Store._get_basket_from_json', list)
|
||||
print(f'basket = {basket}')
|
||||
Helper_App.console_log(f'basket = {basket}')
|
||||
return basket
|
||||
|
||||
def import_JSON_basket(self, json_data):
|
||||
@@ -378,7 +379,7 @@ class Model_View_Store(Model_View_Base):
|
||||
id_currency = basket[self.KEY_ID_CURRENCY]
|
||||
id_region_delivery = basket[self.KEY_ID_REGION_DELIVERY]
|
||||
is_included_VAT = basket[self.KEY_IS_INCLUDED_VAT]
|
||||
print(f'json basket items: {items}')
|
||||
Helper_App.console_log(f'json basket items: {items}')
|
||||
product_ids, permutation_ids, item_index_dict = self._get_json_basket_id_CSVs_product_permutation(items)
|
||||
category_list, errors = DataStore_Store_Base().get_many_product(Parameters_Product(
|
||||
self.id_user, # :a_id_user
|
||||
@@ -390,7 +391,7 @@ class Model_View_Store(Model_View_Base):
|
||||
False, str(id_currency), False, # :a_get_all_currency, :a_ids_currency, :a_get_inactive_currency
|
||||
True, '', False # :a_get_all_discount, :a_ids_discount, :a_get_inactive_discount
|
||||
)) # product_ids=product_ids, get_all_category=False, get_all_product=False)
|
||||
# print(f'categories = {categories}')
|
||||
# Helper_App.console_log(f'categories = {categories}')
|
||||
self.basket = Basket(id_currency, id_region_delivery, is_included_VAT)
|
||||
if len(category_list.categories) > 0: # not (categories is None):
|
||||
for category in category_list.categories:
|
||||
@@ -404,8 +405,8 @@ class Model_View_Store(Model_View_Base):
|
||||
if len(items) > 0:
|
||||
for index_item in range(len(items)):
|
||||
"""
|
||||
print(f'basket data: {json_data}')
|
||||
print(f'basket: {self.basket}')
|
||||
Helper_App.console_log(f'basket data: {json_data}')
|
||||
Helper_App.console_log(f'basket: {self.basket}')
|
||||
|
||||
# ids_permutation_unavailable_region_or_currency = []
|
||||
# id_permutation_unavailable_otherwise = []
|
||||
@@ -445,11 +446,11 @@ class Model_View_Store(Model_View_Base):
|
||||
|
||||
def import_JSON_basket_item(self, json_data, form_basket = None):
|
||||
_m = 'Model_View_Store.import_JSON_basket_item'
|
||||
print(f'starting {_m}')
|
||||
# print('getting product id')
|
||||
Helper_App.console_log(f'starting {_m}')
|
||||
# Helper_App.console_log('getting product id')
|
||||
# product_id = av.input_int(json_data[self.key_id_product], self.key_id_product, _m)
|
||||
|
||||
# print(f'product id: {product_id}, type: {str(type(product_id))}')
|
||||
# Helper_App.console_log(f'product id: {product_id}, type: {str(type(product_id))}')
|
||||
try:
|
||||
permutation_id = json_data[self.KEY_ID_PERMUTATION]
|
||||
av.full_val_int(permutation_id, self.KEY_ID_PERMUTATION, _m)
|
||||
@@ -457,21 +458,21 @@ class Model_View_Store(Model_View_Base):
|
||||
except:
|
||||
permutation_id = None
|
||||
if not permutation_id == 'None':
|
||||
print(f'permutation_id invalid: {permutation_id}')
|
||||
Helper_App.console_log(f'permutation_id invalid: {permutation_id}')
|
||||
raise ValueError("Invalid permutation id")
|
||||
print(f'permutation_id: {permutation_id}')
|
||||
Helper_App.console_log(f'permutation_id: {permutation_id}')
|
||||
|
||||
try:
|
||||
print(f'form_basket: {form_basket}')
|
||||
print('getting quantity')
|
||||
print(f'form_basket.quantity: {form_basket.quantity}')
|
||||
print(f'form_basket.quantity.data: {form_basket.quantity.data}')
|
||||
Helper_App.console_log(f'form_basket: {form_basket}')
|
||||
Helper_App.console_log('getting quantity')
|
||||
Helper_App.console_log(f'form_basket.quantity: {form_basket.quantity}')
|
||||
Helper_App.console_log(f'form_basket.quantity.data: {form_basket.quantity.data}')
|
||||
quantity = int(form_basket.quantity.data)
|
||||
except:
|
||||
quantity = 0
|
||||
print(f'quantity: {quantity}')
|
||||
Helper_App.console_log(f'quantity: {quantity}')
|
||||
|
||||
print(f'permutation_id: {permutation_id}\nquantity: {quantity}')
|
||||
Helper_App.console_log(f'permutation_id: {permutation_id}\nquantity: {quantity}')
|
||||
|
||||
return permutation_id, quantity
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ from business_objects.store.product import Product, Parameters_Product
|
||||
from business_objects.store.product_category import Product_Category_Container
|
||||
from business_objects.store.manufacturing_purchase_order import Manufacturing_Purchase_Order, Parameters_Manufacturing_Purchase_Order, Manufacturing_Purchase_Order_Product_Link
|
||||
from forms.store.manufacturing_purchase_order import Filters_Manufacturing_Purchase_Order
|
||||
from helpers.helper_app import Helper_App
|
||||
import lib.argument_validation as av
|
||||
# external
|
||||
from typing import ClassVar
|
||||
@@ -41,7 +42,7 @@ class Model_View_Store_Manufacturing_Purchase_Order(Model_View_Store):
|
||||
|
||||
def __init__(self, form_filters_old, hash_page_current=Model_View_Store.HASH_PAGE_STORE_MANUFACTURING_PURCHASE_ORDERS):
|
||||
_m = 'Model_View_Store_Manufacturing.__init__'
|
||||
print(f'{_m}\nstarting...')
|
||||
Helper_App.console_log(f'{_m}\nstarting...')
|
||||
super().__init__(hash_page_current = hash_page_current, form_filters_old = form_filters_old)
|
||||
self.form_filters = form_filters_old # Filters_Manufacturing_Purchase_Order.from_json(form_filters_old.to_json())
|
||||
parameters_manufacturing_purchase_order = Parameters_Manufacturing_Purchase_Order.from_filters_manufacturing_purchase_order(form_filters_old)
|
||||
|
||||
@@ -21,6 +21,7 @@ from business_objects.store.product_category import Product_Category_Container
|
||||
from datastores.datastore_store_product import DataStore_Store_Product
|
||||
from forms.access_level import Filters_Access_Level
|
||||
from forms.store.product import Filters_Product
|
||||
from helpers.helper_app import Helper_App
|
||||
from models.model_view_store import Model_View_Store
|
||||
# from routes import bp_home
|
||||
import lib.argument_validation as av
|
||||
@@ -40,9 +41,9 @@ class Model_View_Store_Product(Model_View_Store):
|
||||
def __init__(self, id_permutation, id_currency, id_region_delivery, is_included_VAT, hash_page_current=Model_View_Store.HASH_PAGE_STORE_PRODUCTS):
|
||||
# Constructor
|
||||
_m = 'Model_View_Store_Product.__init__'
|
||||
print(f'{_m}\nstarting...')
|
||||
Helper_App.console_log(f'{_m}\nstarting...')
|
||||
super().__init__(hash_page_current=hash_page_current, id_currency=id_currency, id_region_delivery=id_region_delivery, is_included_VAT=is_included_VAT)
|
||||
print('supered')
|
||||
Helper_App.console_log('supered')
|
||||
|
||||
category_list = DataStore_Store_Base().get_many_product(Parameters_Product(
|
||||
self.info_user['sub'],
|
||||
@@ -54,7 +55,7 @@ class Model_View_Store_Product(Model_View_Store):
|
||||
False, str(id_currency), False,
|
||||
True, '', False
|
||||
)) # product_ids=str(id_product), permutation_ids=str(id_permutation))
|
||||
print('connection to db successful')
|
||||
Helper_App.console_log('connection to db successful')
|
||||
# self.categories = categories
|
||||
# self.category_index = category_index
|
||||
""
|
||||
@@ -62,7 +63,7 @@ class Model_View_Store_Product(Model_View_Store):
|
||||
self.product = category_list.get_permutation_first()
|
||||
else:
|
||||
self.product = None
|
||||
print('selected permutation selected')
|
||||
Helper_App.console_log('selected permutation selected')
|
||||
""
|
||||
"""
|
||||
|
||||
@@ -88,7 +89,7 @@ class Model_View_Store_Product(Model_View_Store):
|
||||
|
||||
def __init__(self, form_filters, hash_page_current=Model_View_Store.HASH_PAGE_STORE_PRODUCTS):
|
||||
_m = 'Model_View_Store_Product.__init__'
|
||||
print(f'{_m}\nstarting...')
|
||||
Helper_App.console_log(f'{_m}\nstarting...')
|
||||
super().__init__(hash_page_current=hash_page_current, form_filters=form_filters)
|
||||
self.access_levels = self.get_many_access_level(Filters_Access_Level())
|
||||
parameters_product = Parameters_Product.from_form_filters_product(self.form_filters)
|
||||
@@ -97,7 +98,7 @@ class Model_View_Store_Product(Model_View_Store):
|
||||
countProducts = 0
|
||||
for category in self.category_list.categories:
|
||||
countProducts += len(category.products)
|
||||
print(f'category count: {len(self.category_list.categories)}\nproduct count: {countProducts}')
|
||||
Helper_App.console_log(f'category count: {len(self.category_list.categories)}\nproduct count: {countProducts}')
|
||||
self.category_list_filters, errors_filters = datastore_store.get_many_product(
|
||||
Parameters_Product(
|
||||
get_all_product_category = True,
|
||||
@@ -115,16 +116,16 @@ class Model_View_Store_Product(Model_View_Store):
|
||||
get_products_quantity_stock_below_min = parameters_product.get_products_quantity_stock_below_min
|
||||
)
|
||||
)
|
||||
print(f'category filters: {self.category_list_filters.categories}')
|
||||
Helper_App.console_log(f'category filters: {self.category_list_filters.categories}')
|
||||
self.form_filters.id_category.choices += [(str(category.id_category), category.name) for category in self.category_list_filters.categories]
|
||||
print(f'category options: {self.form_filters.id_category.choices}')
|
||||
Helper_App.console_log(f'category options: {self.form_filters.id_category.choices}')
|
||||
self.variation_types, self.variations, errors = self.get_many_product_variation()
|
||||
self.units_measurement = self.get_many_unit_measurement()
|
||||
self.units_measurement_time = [unit_measurement for unit_measurement in self.units_measurement if unit_measurement.is_unit_of_time]
|
||||
self.currencies = self.get_many_currency()
|
||||
self.currency_options = [currency.to_json_option() for currency in self.currencies]
|
||||
|
||||
print(f'category count: {len(self.category_list.categories)}\nproduct count: {countProducts}')
|
||||
Helper_App.console_log(f'category count: {len(self.category_list.categories)}\nproduct count: {countProducts}')
|
||||
@staticmethod
|
||||
def save_products(comment, list_products):
|
||||
_m = 'Model_View_Store_Product.save_products'
|
||||
|
||||
@@ -21,6 +21,7 @@ from forms.store.product_category import Filters_Product_Category
|
||||
# from routes import bp_home
|
||||
from business_objects.store.product import Product, Parameters_Product, Product_Permutation
|
||||
from business_objects.store.product_variation import Product_Variation_Container
|
||||
from helpers.helper_app import Helper_App
|
||||
import lib.argument_validation as av
|
||||
|
||||
# external
|
||||
@@ -40,7 +41,7 @@ class Model_View_Store_Product_Category(Model_View_Store):
|
||||
|
||||
def __init__(self, form_filters, hash_page_current=Model_View_Store.HASH_PAGE_STORE_PRODUCT_CATEGORIES):
|
||||
_m = 'Model_View_Store_Product_Category.__init__'
|
||||
print(f'{_m}\nstarting...')
|
||||
Helper_App.console_log(f'{_m}\nstarting...')
|
||||
super().__init__(hash_page_current=hash_page_current, form_filters=form_filters) # filters_category=filters_category)
|
||||
# BaseModel.__init__(self, app=app, filters_product=filters_product, **kwargs)
|
||||
self.access_levels = self.get_many_access_level(Filters_Access_Level())
|
||||
|
||||
@@ -18,6 +18,7 @@ from forms.store.product_permutation import Filters_Product_Permutation
|
||||
# from routes import bp_home
|
||||
from business_objects.store.product import Product, Parameters_Product, Product_Permutation
|
||||
from business_objects.store.product_variation import Product_Variation_Container
|
||||
from helpers.helper_app import Helper_App
|
||||
import lib.argument_validation as av
|
||||
|
||||
# external
|
||||
@@ -44,7 +45,7 @@ class Model_View_Store_Product_Permutation(Model_View_Store):
|
||||
|
||||
def __init__(self, form_filters, hash_page_current=Model_View_Store.HASH_PAGE_STORE_PRODUCT_PERMUTATIONS):
|
||||
_m = 'Model_View_Store_Permutation.__init__'
|
||||
print(f'{_m}\nstarting...')
|
||||
Helper_App.console_log(f'{_m}\nstarting...')
|
||||
super().__init__(hash_page_current=hash_page_current, form_filters=form_filters)
|
||||
# self.form_filters = Filters_Product_Permutation()
|
||||
filters_product = Parameters_Product.from_form_filters_product_permutation(self.form_filters)
|
||||
@@ -67,11 +68,11 @@ class Model_View_Store_Product_Permutation(Model_View_Store):
|
||||
get_products_quantity_stock_below_min = filters_product.get_products_quantity_stock_below_min
|
||||
)
|
||||
)
|
||||
print(f'category filters: {self.category_list_filters.categories}')
|
||||
Helper_App.console_log(f'category filters: {self.category_list_filters.categories}')
|
||||
self.form_filters.id_category.choices += [(str(category.id_category), category.name) for category in self.category_list_filters.categories]
|
||||
print(f'category options: {self.form_filters.id_category.choices}')
|
||||
Helper_App.console_log(f'category options: {self.form_filters.id_category.choices}')
|
||||
self.list_options_product = self.category_list_filters.to_product_option_list()
|
||||
print(f'product options: {self.list_options_product}')
|
||||
Helper_App.console_log(f'product options: {self.list_options_product}')
|
||||
self.form_filters.id_product.choices += [(str(product['value']), product['text']) for product in self.list_options_product]
|
||||
self.variation_types, self.variations, errors = self.get_many_product_variation()
|
||||
self.units_measurement = self.get_many_unit_measurement()
|
||||
|
||||
@@ -18,6 +18,7 @@ from business_objects.store.product_category import Product_Category_Container
|
||||
from business_objects.store.product import Product, Parameters_Product, Product_Permutation
|
||||
from business_objects.store.stock_item import Stock_Item, Parameters_Stock_Item
|
||||
from forms.store.stock_item import Filters_Stock_Item
|
||||
from helpers.helper_app import Helper_App
|
||||
import lib.argument_validation as av
|
||||
|
||||
# external
|
||||
@@ -43,7 +44,7 @@ class Model_View_Store_Stock_Item(Model_View_Store):
|
||||
|
||||
def __init__(self, filters_stock_item, hash_page_current=Model_View_Store.HASH_PAGE_STORE_STOCK_ITEMS):
|
||||
_m = 'Model_View_Store_Stock_Item.__init__'
|
||||
print(f'{_m}\nstarting...')
|
||||
Helper_App.console_log(f'{_m}\nstarting...')
|
||||
super().__init__(hash_page_current=hash_page_current, filters_stock_item=filters_stock_item)
|
||||
# BaseModel.__init__(self, app=app, filters_stock_item=filters_stock_item, **kwargs)
|
||||
self.form_filters = Filters_Stock_Item.from_json(filters_stock_item.to_json()) # .from_form_stock_item(filters_stock_item)
|
||||
@@ -68,17 +69,17 @@ class Model_View_Store_Stock_Item(Model_View_Store):
|
||||
)
|
||||
"""
|
||||
|
||||
print(f'category_list_filters: {self.category_list_filters.categories}')
|
||||
Helper_App.console_log(f'category_list_filters: {self.category_list_filters.categories}')
|
||||
self.form_filters.id_category.choices += [(str(category.id_category), category.name) for category in self.category_list_filters.categories] # [Filters_Stock_Item.get_choice_all()] +
|
||||
print(f'category options: {self.form_filters.id_category.choices}')
|
||||
Helper_App.console_log(f'category options: {self.form_filters.id_category.choices}')
|
||||
product_list = self.category_list_filters.to_product_option_list()
|
||||
filtered_product_list = []
|
||||
if product_list is not None:
|
||||
for product in product_list:
|
||||
# print(f'product: {product}\n{product[Stock_Item.ATTR_ID_PRODUCT_CATEGORY]}\n{self.form_filters.id_category.data}\n{str(type(product[Stock_Item.ATTR_ID_PRODUCT_CATEGORY]))}\n{str(type(self.form_filters.id_category.data))}')
|
||||
# Helper_App.console_log(f'product: {product}\n{product[Stock_Item.ATTR_ID_PRODUCT_CATEGORY]}\n{self.form_filters.id_category.data}\n{str(type(product[Stock_Item.ATTR_ID_PRODUCT_CATEGORY]))}\n{str(type(self.form_filters.id_category.data))}')
|
||||
if (self.form_filters.id_category.data == '' or str(product[Stock_Item.ATTR_ID_PRODUCT_CATEGORY]) == self.form_filters.id_category.data):
|
||||
filtered_product_list.append(product)
|
||||
print(f'product_list: {product_list}\nfiltered_product_list: {filtered_product_list}')
|
||||
Helper_App.console_log(f'product_list: {product_list}\nfiltered_product_list: {filtered_product_list}')
|
||||
self.form_filters.id_product.choices += [(str(product['value']), product['text']) for product in filtered_product_list] # [Filters_Stock_Item.get_choice_all()] +
|
||||
# self.form_filters.import_values(filters_stock_item)
|
||||
self.variation_types, self.variations, errors = self.get_many_product_variation()
|
||||
|
||||
@@ -15,6 +15,7 @@ from models.model_view_store import Model_View_Store
|
||||
from datastores.datastore_store_supplier import DataStore_Store_Supplier
|
||||
from business_objects.store.supplier import Supplier, Parameters_Supplier
|
||||
from forms.store.supplier import Filters_Supplier
|
||||
from helpers.helper_app import Helper_App
|
||||
import lib.argument_validation as av
|
||||
# external
|
||||
from typing import ClassVar
|
||||
@@ -39,7 +40,7 @@ class Model_View_Store_Supplier(Model_View_Store):
|
||||
|
||||
def __init__(self, form_filters_old, hash_page_current=Model_View_Store.HASH_PAGE_STORE_SUPPLIERS):
|
||||
_m = 'Model_View_Store_Supplier.__init__'
|
||||
print(f'{_m}\nstarting...')
|
||||
Helper_App.console_log(f'{_m}\nstarting...')
|
||||
super().__init__(hash_page_current = hash_page_current, form_filters_old = form_filters_old)
|
||||
self.form_filters = form_filters_old # Filters_Supplier.from_json(form_filters_old.to_json())
|
||||
parameters_supplier = Parameters_Supplier.from_filters_supplier(self.form_filters)
|
||||
|
||||
@@ -19,6 +19,7 @@ from business_objects.store.product_category import Product_Category_Container
|
||||
from business_objects.store.supplier import Supplier, Parameters_Supplier
|
||||
from business_objects.store.supplier_purchase_order import Supplier_Purchase_Order, Parameters_Supplier_Purchase_Order
|
||||
from forms.store.supplier_purchase_order import Filters_Supplier_Purchase_Order
|
||||
from helpers.helper_app import Helper_App
|
||||
import lib.argument_validation as av
|
||||
|
||||
class Model_View_Store_Supplier_Purchase_Order(Model_View_Store):
|
||||
@@ -40,7 +41,7 @@ class Model_View_Store_Supplier_Purchase_Order(Model_View_Store):
|
||||
|
||||
def __init__(self, form_filters_old, hash_page_current=Model_View_Store.HASH_PAGE_STORE_SUPPLIER_PURCHASE_ORDERS):
|
||||
_m = 'Model_View_Store_Supplier.__init__'
|
||||
print(f'{_m}\nstarting...')
|
||||
Helper_App.console_log(f'{_m}\nstarting...')
|
||||
super().__init__(hash_page_current = hash_page_current, form_filters_old = form_filters_old)
|
||||
self.form_filters = form_filters_old # Filters_Supplier_Purchase_Order.from_json(form_filters_old.to_json())
|
||||
parameters_supplier_purchase_order = Parameters_Supplier_Purchase_Order.from_filters_supplier_purchase_order(self.form_filters)
|
||||
|
||||
@@ -185,6 +185,7 @@ DROP TABLE IF EXISTS Shop_Interval_Recurrence;
|
||||
|
||||
DROP TABLE IF EXISTS Shop_Product_Audit;
|
||||
DROP TABLE IF EXISTS Shop_Product;
|
||||
DROP TABLE IF EXISTS Shop_Product_Temp;
|
||||
|
||||
DROP TABLE IF EXISTS Shop_Product_Category_Temp;
|
||||
DROP TABLE IF EXISTS Shop_Product_Category_Audit;
|
||||
|
||||
@@ -185,6 +185,7 @@ DROP TABLE IF EXISTS Shop_Interval_Recurrence;
|
||||
|
||||
DROP TABLE IF EXISTS Shop_Product_Audit;
|
||||
DROP TABLE IF EXISTS Shop_Product;
|
||||
DROP TABLE IF EXISTS Shop_Product_Temp;
|
||||
|
||||
DROP TABLE IF EXISTS Shop_Product_Category_Temp;
|
||||
DROP TABLE IF EXISTS Shop_Product_Category_Audit;
|
||||
|
||||
@@ -486,7 +486,7 @@ CALL partsltd_prod.p_shop_get_many_product (
|
||||
, 0 # a_get_inactive_image
|
||||
, '' # a_ids_image
|
||||
, 0 # a_get_products_quantity_stock_below_minimum
|
||||
, 1 # a_debug
|
||||
, 0 # a_debug
|
||||
);
|
||||
|
||||
select * FROM partsltd_prod.Shop_Calc_User_Temp;
|
||||
|
||||
2
static/dist/js/core_admin_home.bundle.js
vendored
2
static/dist/js/core_admin_home.bundle.js
vendored
@@ -1 +1 @@
|
||||
(()=>{"use strict";var r,e={561:()=>{},711:()=>{}},o={};function t(r){var a=o[r];if(void 0!==a)return a.exports;var n=o[r]={exports:{}};return e[r](n,n.exports,t),n.exports}t.m=e,r=[],t.O=(e,o,a,n)=>{if(!o){var i=1/0;for(f=0;f<r.length;f++){for(var[o,a,n]=r[f],p=!0,v=0;v<o.length;v++)(!1&n||i>=n)&&Object.keys(t.O).every((r=>t.O[r](o[v])))?o.splice(v--,1):(p=!1,n<i&&(i=n));if(p){r.splice(f--,1);var s=a();void 0!==s&&(e=s)}}return e}n=n||0;for(var f=r.length;f>0&&r[f-1][2]>n;f--)r[f]=r[f-1];r[f]=[o,a,n]},t.o=(r,e)=>Object.prototype.hasOwnProperty.call(r,e),(()=>{var r={780:0,466:0};t.O.j=e=>0===r[e];var e=(e,o)=>{var a,n,[i,p,v]=o,s=0;if(i.some((e=>0!==r[e]))){for(a in p)t.o(p,a)&&(t.m[a]=p[a]);if(v)var f=v(t)}for(e&&e(o);s<i.length;s++)n=i[s],t.o(r,n)&&r[n]&&r[n][0](),r[n]=0;return t.O(f)},o=self.webpackChunkapp=self.webpackChunkapp||[];o.forEach(e.bind(null,0)),o.push=e.bind(null,o.push.bind(o))})(),t.O(void 0,[466],(()=>t(711)));var a=t.O(void 0,[466],(()=>t(561)));a=t.O(a)})();
|
||||
(()=>{"use strict";var r,e={497:()=>{},647:()=>{}},o={};function t(r){var a=o[r];if(void 0!==a)return a.exports;var n=o[r]={exports:{}};return e[r](n,n.exports,t),n.exports}t.m=e,r=[],t.O=(e,o,a,n)=>{if(!o){var i=1/0;for(f=0;f<r.length;f++){for(var[o,a,n]=r[f],p=!0,v=0;v<o.length;v++)(!1&n||i>=n)&&Object.keys(t.O).every((r=>t.O[r](o[v])))?o.splice(v--,1):(p=!1,n<i&&(i=n));if(p){r.splice(f--,1);var s=a();void 0!==s&&(e=s)}}return e}n=n||0;for(var f=r.length;f>0&&r[f-1][2]>n;f--)r[f]=r[f-1];r[f]=[o,a,n]},t.o=(r,e)=>Object.prototype.hasOwnProperty.call(r,e),(()=>{var r={780:0,564:0};t.O.j=e=>0===r[e];var e=(e,o)=>{var a,n,[i,p,v]=o,s=0;if(i.some((e=>0!==r[e]))){for(a in p)t.o(p,a)&&(t.m[a]=p[a]);if(v)var f=v(t)}for(e&&e(o);s<i.length;s++)n=i[s],t.o(r,n)&&r[n]&&r[n][0](),r[n]=0;return t.O(f)},o=self.webpackChunkapp=self.webpackChunkapp||[];o.forEach(e.bind(null,0)),o.push=e.bind(null,o.push.bind(o))})(),t.O(void 0,[564],(()=>t(647)));var a=t.O(void 0,[564],(()=>t(497)));a=t.O(a)})();
|
||||
2
static/dist/js/core_contact.bundle.js
vendored
2
static/dist/js/core_contact.bundle.js
vendored
@@ -1 +1 @@
|
||||
(()=>{"use strict";var r,e={278:()=>{},711:()=>{}},o={};function t(r){var a=o[r];if(void 0!==a)return a.exports;var n=o[r]={exports:{}};return e[r](n,n.exports,t),n.exports}t.m=e,r=[],t.O=(e,o,a,n)=>{if(!o){var i=1/0;for(f=0;f<r.length;f++){for(var[o,a,n]=r[f],p=!0,v=0;v<o.length;v++)(!1&n||i>=n)&&Object.keys(t.O).every((r=>t.O[r](o[v])))?o.splice(v--,1):(p=!1,n<i&&(i=n));if(p){r.splice(f--,1);var s=a();void 0!==s&&(e=s)}}return e}n=n||0;for(var f=r.length;f>0&&r[f-1][2]>n;f--)r[f]=r[f-1];r[f]=[o,a,n]},t.o=(r,e)=>Object.prototype.hasOwnProperty.call(r,e),(()=>{var r={775:0,466:0};t.O.j=e=>0===r[e];var e=(e,o)=>{var a,n,[i,p,v]=o,s=0;if(i.some((e=>0!==r[e]))){for(a in p)t.o(p,a)&&(t.m[a]=p[a]);if(v)var f=v(t)}for(e&&e(o);s<i.length;s++)n=i[s],t.o(r,n)&&r[n]&&r[n][0](),r[n]=0;return t.O(f)},o=self.webpackChunkapp=self.webpackChunkapp||[];o.forEach(e.bind(null,0)),o.push=e.bind(null,o.push.bind(o))})(),t.O(void 0,[466],(()=>t(711)));var a=t.O(void 0,[466],(()=>t(278)));a=t.O(a)})();
|
||||
(()=>{"use strict";var r,e={206:()=>{},647:()=>{}},o={};function t(r){var a=o[r];if(void 0!==a)return a.exports;var n=o[r]={exports:{}};return e[r](n,n.exports,t),n.exports}t.m=e,r=[],t.O=(e,o,a,n)=>{if(!o){var i=1/0;for(f=0;f<r.length;f++){for(var[o,a,n]=r[f],p=!0,v=0;v<o.length;v++)(!1&n||i>=n)&&Object.keys(t.O).every((r=>t.O[r](o[v])))?o.splice(v--,1):(p=!1,n<i&&(i=n));if(p){r.splice(f--,1);var s=a();void 0!==s&&(e=s)}}return e}n=n||0;for(var f=r.length;f>0&&r[f-1][2]>n;f--)r[f]=r[f-1];r[f]=[o,a,n]},t.o=(r,e)=>Object.prototype.hasOwnProperty.call(r,e),(()=>{var r={775:0,564:0};t.O.j=e=>0===r[e];var e=(e,o)=>{var a,n,[i,p,v]=o,s=0;if(i.some((e=>0!==r[e]))){for(a in p)t.o(p,a)&&(t.m[a]=p[a]);if(v)var f=v(t)}for(e&&e(o);s<i.length;s++)n=i[s],t.o(r,n)&&r[n]&&r[n][0](),r[n]=0;return t.O(f)},o=self.webpackChunkapp=self.webpackChunkapp||[];o.forEach(e.bind(null,0)),o.push=e.bind(null,o.push.bind(o))})(),t.O(void 0,[564],(()=>t(647)));var a=t.O(void 0,[564],(()=>t(206)));a=t.O(a)})();
|
||||
2
static/dist/js/core_home.bundle.js
vendored
2
static/dist/js/core_home.bundle.js
vendored
@@ -1 +1 @@
|
||||
(()=>{"use strict";var r,e={805:()=>{},711:()=>{}},o={};function t(r){var a=o[r];if(void 0!==a)return a.exports;var n=o[r]={exports:{}};return e[r](n,n.exports,t),n.exports}t.m=e,r=[],t.O=(e,o,a,n)=>{if(!o){var i=1/0;for(f=0;f<r.length;f++){for(var[o,a,n]=r[f],p=!0,v=0;v<o.length;v++)(!1&n||i>=n)&&Object.keys(t.O).every((r=>t.O[r](o[v])))?o.splice(v--,1):(p=!1,n<i&&(i=n));if(p){r.splice(f--,1);var s=a();void 0!==s&&(e=s)}}return e}n=n||0;for(var f=r.length;f>0&&r[f-1][2]>n;f--)r[f]=r[f-1];r[f]=[o,a,n]},t.o=(r,e)=>Object.prototype.hasOwnProperty.call(r,e),(()=>{var r={664:0,466:0};t.O.j=e=>0===r[e];var e=(e,o)=>{var a,n,[i,p,v]=o,s=0;if(i.some((e=>0!==r[e]))){for(a in p)t.o(p,a)&&(t.m[a]=p[a]);if(v)var f=v(t)}for(e&&e(o);s<i.length;s++)n=i[s],t.o(r,n)&&r[n]&&r[n][0](),r[n]=0;return t.O(f)},o=self.webpackChunkapp=self.webpackChunkapp||[];o.forEach(e.bind(null,0)),o.push=e.bind(null,o.push.bind(o))})(),t.O(void 0,[466],(()=>t(711)));var a=t.O(void 0,[466],(()=>t(805)));a=t.O(a)})();
|
||||
(()=>{"use strict";var r,e={469:()=>{},647:()=>{}},o={};function t(r){var a=o[r];if(void 0!==a)return a.exports;var n=o[r]={exports:{}};return e[r](n,n.exports,t),n.exports}t.m=e,r=[],t.O=(e,o,a,n)=>{if(!o){var i=1/0;for(f=0;f<r.length;f++){for(var[o,a,n]=r[f],p=!0,v=0;v<o.length;v++)(!1&n||i>=n)&&Object.keys(t.O).every((r=>t.O[r](o[v])))?o.splice(v--,1):(p=!1,n<i&&(i=n));if(p){r.splice(f--,1);var s=a();void 0!==s&&(e=s)}}return e}n=n||0;for(var f=r.length;f>0&&r[f-1][2]>n;f--)r[f]=r[f-1];r[f]=[o,a,n]},t.o=(r,e)=>Object.prototype.hasOwnProperty.call(r,e),(()=>{var r={664:0,564:0};t.O.j=e=>0===r[e];var e=(e,o)=>{var a,n,[i,p,v]=o,s=0;if(i.some((e=>0!==r[e]))){for(a in p)t.o(p,a)&&(t.m[a]=p[a]);if(v)var f=v(t)}for(e&&e(o);s<i.length;s++)n=i[s],t.o(r,n)&&r[n]&&r[n][0](),r[n]=0;return t.O(f)},o=self.webpackChunkapp=self.webpackChunkapp||[];o.forEach(e.bind(null,0)),o.push=e.bind(null,o.push.bind(o))})(),t.O(void 0,[564],(()=>t(647)));var a=t.O(void 0,[564],(()=>t(469)));a=t.O(a)})();
|
||||
2
static/dist/js/core_services.bundle.js
vendored
2
static/dist/js/core_services.bundle.js
vendored
@@ -1 +1 @@
|
||||
(()=>{"use strict";var r,e={188:()=>{},711:()=>{}},o={};function t(r){var a=o[r];if(void 0!==a)return a.exports;var n=o[r]={exports:{}};return e[r](n,n.exports,t),n.exports}t.m=e,r=[],t.O=(e,o,a,n)=>{if(!o){var i=1/0;for(f=0;f<r.length;f++){for(var[o,a,n]=r[f],p=!0,v=0;v<o.length;v++)(!1&n||i>=n)&&Object.keys(t.O).every((r=>t.O[r](o[v])))?o.splice(v--,1):(p=!1,n<i&&(i=n));if(p){r.splice(f--,1);var s=a();void 0!==s&&(e=s)}}return e}n=n||0;for(var f=r.length;f>0&&r[f-1][2]>n;f--)r[f]=r[f-1];r[f]=[o,a,n]},t.o=(r,e)=>Object.prototype.hasOwnProperty.call(r,e),(()=>{var r={405:0,466:0};t.O.j=e=>0===r[e];var e=(e,o)=>{var a,n,[i,p,v]=o,s=0;if(i.some((e=>0!==r[e]))){for(a in p)t.o(p,a)&&(t.m[a]=p[a]);if(v)var f=v(t)}for(e&&e(o);s<i.length;s++)n=i[s],t.o(r,n)&&r[n]&&r[n][0](),r[n]=0;return t.O(f)},o=self.webpackChunkapp=self.webpackChunkapp||[];o.forEach(e.bind(null,0)),o.push=e.bind(null,o.push.bind(o))})(),t.O(void 0,[466],(()=>t(711)));var a=t.O(void 0,[466],(()=>t(188)));a=t.O(a)})();
|
||||
(()=>{"use strict";var r,e={396:()=>{},647:()=>{}},o={};function t(r){var a=o[r];if(void 0!==a)return a.exports;var n=o[r]={exports:{}};return e[r](n,n.exports,t),n.exports}t.m=e,r=[],t.O=(e,o,a,n)=>{if(!o){var i=1/0;for(f=0;f<r.length;f++){for(var[o,a,n]=r[f],p=!0,v=0;v<o.length;v++)(!1&n||i>=n)&&Object.keys(t.O).every((r=>t.O[r](o[v])))?o.splice(v--,1):(p=!1,n<i&&(i=n));if(p){r.splice(f--,1);var s=a();void 0!==s&&(e=s)}}return e}n=n||0;for(var f=r.length;f>0&&r[f-1][2]>n;f--)r[f]=r[f-1];r[f]=[o,a,n]},t.o=(r,e)=>Object.prototype.hasOwnProperty.call(r,e),(()=>{var r={405:0,564:0};t.O.j=e=>0===r[e];var e=(e,o)=>{var a,n,[i,p,v]=o,s=0;if(i.some((e=>0!==r[e]))){for(a in p)t.o(p,a)&&(t.m[a]=p[a]);if(v)var f=v(t)}for(e&&e(o);s<i.length;s++)n=i[s],t.o(r,n)&&r[n]&&r[n][0](),r[n]=0;return t.O(f)},o=self.webpackChunkapp=self.webpackChunkapp||[];o.forEach(e.bind(null,0)),o.push=e.bind(null,o.push.bind(o))})(),t.O(void 0,[564],(()=>t(647)));var a=t.O(void 0,[564],(()=>t(396)));a=t.O(a)})();
|
||||
@@ -1 +1 @@
|
||||
(()=>{"use strict";var r,e={780:()=>{},359:()=>{}},o={};function t(r){var a=o[r];if(void 0!==a)return a.exports;var n=o[r]={exports:{}};return e[r](n,n.exports,t),n.exports}t.m=e,r=[],t.O=(e,o,a,n)=>{if(!o){var i=1/0;for(f=0;f<r.length;f++){for(var[o,a,n]=r[f],p=!0,v=0;v<o.length;v++)(!1&n||i>=n)&&Object.keys(t.O).every((r=>t.O[r](o[v])))?o.splice(v--,1):(p=!1,n<i&&(i=n));if(p){r.splice(f--,1);var s=a();void 0!==s&&(e=s)}}return e}n=n||0;for(var f=r.length;f>0&&r[f-1][2]>n;f--)r[f]=r[f-1];r[f]=[o,a,n]},t.o=(r,e)=>Object.prototype.hasOwnProperty.call(r,e),(()=>{var r={841:0,416:0};t.O.j=e=>0===r[e];var e=(e,o)=>{var a,n,[i,p,v]=o,s=0;if(i.some((e=>0!==r[e]))){for(a in p)t.o(p,a)&&(t.m[a]=p[a]);if(v)var f=v(t)}for(e&&e(o);s<i.length;s++)n=i[s],t.o(r,n)&&r[n]&&r[n][0](),r[n]=0;return t.O(f)},o=self.webpackChunkapp=self.webpackChunkapp||[];o.forEach(e.bind(null,0)),o.push=e.bind(null,o.push.bind(o))})(),t.O(void 0,[416],(()=>t(359)));var a=t.O(void 0,[416],(()=>t(780)));a=t.O(a)})();
|
||||
(()=>{"use strict";var r,e={132:()=>{},807:()=>{}},o={};function t(r){var a=o[r];if(void 0!==a)return a.exports;var n=o[r]={exports:{}};return e[r](n,n.exports,t),n.exports}t.m=e,r=[],t.O=(e,o,a,n)=>{if(!o){var i=1/0;for(f=0;f<r.length;f++){for(var[o,a,n]=r[f],p=!0,v=0;v<o.length;v++)(!1&n||i>=n)&&Object.keys(t.O).every((r=>t.O[r](o[v])))?o.splice(v--,1):(p=!1,n<i&&(i=n));if(p){r.splice(f--,1);var s=a();void 0!==s&&(e=s)}}return e}n=n||0;for(var f=r.length;f>0&&r[f-1][2]>n;f--)r[f]=r[f-1];r[f]=[o,a,n]},t.o=(r,e)=>Object.prototype.hasOwnProperty.call(r,e),(()=>{var r={841:0,830:0};t.O.j=e=>0===r[e];var e=(e,o)=>{var a,n,[i,p,v]=o,s=0;if(i.some((e=>0!==r[e]))){for(a in p)t.o(p,a)&&(t.m[a]=p[a]);if(v)var f=v(t)}for(e&&e(o);s<i.length;s++)n=i[s],t.o(r,n)&&r[n]&&r[n][0](),r[n]=0;return t.O(f)},o=self.webpackChunkapp=self.webpackChunkapp||[];o.forEach(e.bind(null,0)),o.push=e.bind(null,o.push.bind(o))})(),t.O(void 0,[830],(()=>t(807)));var a=t.O(void 0,[830],(()=>t(132)));a=t.O(a)})();
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user