stranck-dev #10
2
app.py
2
app.py
|
@ -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)
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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")
|
||||
|
|
6
utils.py
6
utils.py
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue