Fix: Remove keys etc. for public demo repo.
This commit is contained in:
@@ -14,14 +14,12 @@ Datastore for Store Product Categories
|
||||
import lib.argument_validation as av
|
||||
from business_objects.store.product_category import Product_Category_Container, Product_Category, Product_Category_Temp
|
||||
from business_objects.sql_error import SQL_Error
|
||||
# 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
|
||||
# external
|
||||
# from abc import ABC, abstractmethod, abstractproperty
|
||||
from flask_sqlalchemy import SQLAlchemy
|
||||
from sqlalchemy import text
|
||||
import stripe
|
||||
@@ -40,8 +38,6 @@ class DataStore_Store_Product_Category(DataStore_Store_Base):
|
||||
_m = 'DataStore_Store_Product_Category.save_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)
|
||||
|
||||
guid = Helper_DB_MySQL.create_guid()
|
||||
now = datetime.now()
|
||||
@@ -50,32 +46,15 @@ class DataStore_Store_Product_Category(DataStore_Store_Base):
|
||||
id_category_new = 0
|
||||
for category in categories:
|
||||
row = Product_Category_Temp.from_product_category(category)
|
||||
# row = category.to_temporary_record()
|
||||
# id_tmp =
|
||||
if row.id_category == '':
|
||||
id_category_new -= 1
|
||||
row.id_category = id_category_new
|
||||
else:
|
||||
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)
|
||||
|
||||
Helper_App.console_log(f'rows: {rows}')
|
||||
"""
|
||||
cursor = db.cursor()
|
||||
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
|
||||
)
|
||||
Helper_App.console_log('bulk upload executed')
|
||||
db.commit()
|
||||
Helper_App.console_log('bulk upload committed')
|
||||
cursor.close()
|
||||
Helper_App.console_log('cursor closed')
|
||||
"""
|
||||
DataStore_Store_Base.upload_bulk(Product_Category_Temp.__tablename__, rows, 1000)
|
||||
|
||||
argument_dict_list = {
|
||||
@@ -92,7 +71,7 @@ class DataStore_Store_Product_Category(DataStore_Store_Base):
|
||||
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])
|
||||
errors = [SQL_Error.from_DB_record(row) for row in result_set_e]
|
||||
for error in errors:
|
||||
Helper_App.console_log(f"Error [{error.code}]: {error.msg}")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user