Updated prints

This commit is contained in:
Stranck 2024-01-11 18:15:56 +01:00
parent 456361c585
commit dafe98dfbb
4 changed files with 8 additions and 6 deletions

2
app.py
View File

@ -176,4 +176,4 @@ async def logour(request):
raise exceptions.Forbidden("You have been logged out.")
if __name__ == "__main__":
app.run(host="0.0.0.0", port=8188, dev=DEV_MODE)
app.run(host="0.0.0.0", port=8188, dev=DEV_MODE, access_log=ACCESS_LOG)

View File

@ -16,6 +16,8 @@ FILL_CACHE = True
CACHE_EXPIRE_TIME = 60 * 60 * 4
DEV_MODE = True
ACCESS_LOG = True
EXTRA_PRINTS = True
# Metadata property for item-id mapping
METADATA_NAME = "item_name"

View File

@ -12,7 +12,7 @@ bp = Blueprint("propic", url_prefix="/manage/propic")
async def resetDefaultPropic(request, order: Order, isFursuiter, sendAnswer=True):
s = "_fursuiter" if isFursuiter else ""
if (DEV_MODE):
if (EXTRA_PRINTS):
print("Resetting {fn} picture for {orderCod}".format(fn="Badge" if not isFursuiter else "fursuit", orderCod = order.code))
with open("res/propic/default.png", "rb") as f:
data = f.read()
@ -100,7 +100,7 @@ async def upload_propic(request, order: Order):
await order.edit_answer_fileUpload(f'{fn}_file', f'{fn}_file_{order.code}.jpg', 'image/jpeg', imgBytes)
except Exception:
import traceback
if DEV_MODE: print(traceback.format_exc())
if EXTRA_PRINTS: print(traceback.format_exc())
raise exceptions.BadRequest(errorDetails if errorDetails else "The image you uploaded is not valid.")
else:
await order.edit_answer(fn, f"{fn}_{order.code}.jpg")

View File

@ -73,7 +73,7 @@ async def loadItems():
categoryName = checkAndGetCategory ('item', q)
if not categoryName: continue
CATEGORIES_LIST_MAP[categoryName].append(q['id'])
if (DEV_MODE):
if (EXTRA_PRINTS):
print (f'Mapped Items:')
print (ITEMS_ID_MAP)
print (f'Mapped Variations:')
@ -86,13 +86,13 @@ async def loadItems():
# Tries to get an item name from metadata. Prints a warning if an item has no metadata
def checkAndGetName(type, q):
itemName = extractMetadataName(q)
if not itemName and DEV_MODE:
if not itemName and EXTRA_PRINTS:
print (type + ' ' + q['id'] + ' has not been mapped.')
return itemName
def checkAndGetCategory (type, q):
categoryName = extractCategory (q)
if not categoryName and DEV_MODE:
if not categoryName and EXTRA_PRINTS:
print (type + ' ' + q['id'] + ' has no category set.')
return categoryName