diff --git a/daemon.py b/daemon.py index f07f65528..e580703cf 100644 --- a/daemon.py +++ b/daemon.py @@ -13821,8 +13821,8 @@ class PubServer(BaseHTTPRequestHandler): self.server.domain) itemQty = 1 if fields['itemQty']: - if fields['itemQty'].isdigit(): - itemQty = int(fields['itemQty']) + if isfloat(fields['itemQty']): + itemQty = float(fields['itemQty']) itemPrice = "0.00" if fields['itemPrice']: if isfloat(fields['itemPrice']): diff --git a/epicyon.py b/epicyon.py index 91a4b36b4..b7b9d3bfd 100644 --- a/epicyon.py +++ b/epicyon.py @@ -562,7 +562,7 @@ parser.add_argument('--summary', dest='summary', type=str, parser.add_argument('--itemImage', dest='itemImage', type=str, default=None, help='Filename of an image for an item being shared') -parser.add_argument('--itemQty', dest='itemQty', type=int, +parser.add_argument('--itemQty', dest='itemQty', type=float, default=1, help='Quantity of items being shared') parser.add_argument('--itemPrice', dest='itemPrice', type=str, diff --git a/shares.py b/shares.py index f3f170cd6..b8a6f501d 100644 --- a/shares.py +++ b/shares.py @@ -235,7 +235,7 @@ def _indicateNewShareAvailable(baseDir: str, httpPrefix: str, def addShare(baseDir: str, httpPrefix: str, nickname: str, domain: str, port: int, displayName: str, summary: str, imageFilename: str, - itemQty: int, itemType: str, itemCategory: str, location: str, + itemQty: float, itemType: str, itemCategory: str, location: str, duration: str, debug: bool, city: str, price: str, currency: str, systemLanguage: str, translate: {}) -> None: @@ -295,7 +295,7 @@ def addShare(baseDir: str, "displayName": displayName, "summary": summary, "imageUrl": imageUrl, - "itemQty": itemQty, + "itemQty": float(itemQty), "dfcId": dfcId, "itemType": itemType, "category": itemCategory, @@ -457,7 +457,7 @@ def sendShareViaServer(baseDir, session, fromDomain: str, fromPort: int, httpPrefix: str, displayName: str, summary: str, imageFilename: str, - itemQty: int, itemType: str, itemCategory: str, + itemQty: float, itemType: str, itemCategory: str, location: str, duration: str, cachedWebfingers: {}, personCache: {}, debug: bool, projectVersion: str, @@ -484,7 +484,7 @@ def sendShareViaServer(baseDir, session, "type": "Offer", "displayName": displayName, "summary": summary, - "itemQty": itemQty, + "itemQty": float(itemQty), "itemType": itemType, "category": itemCategory, "location": location, @@ -711,7 +711,7 @@ def outboxShareUpload(baseDir: str, httpPrefix: str, messageJson['object']['displayName'], messageJson['object']['summary'], messageJson['object']['imageFilename'], - messageJson['object']['itemQty'], + float(messageJson['object']['itemQty']), messageJson['object']['itemType'], messageJson['object']['itemCategory'], messageJson['object']['location'], @@ -855,7 +855,7 @@ def sharesCatalogAccountEndpoint(baseDir: str, httpPrefix: str, "DFC:hasType": dfcId, "DFC:startDate": item['published'], "DFC:expiryDate": expireDateStr, - "DFC:quantity": item['itemQty'], + "DFC:quantity": float(item['itemQty']), "DFC:price": priceStr, "DFC:Image": item['imageUrl'], "DFC:description": description @@ -940,7 +940,7 @@ def sharesCatalogEndpoint(baseDir: str, httpPrefix: str, "DFC:hasType": dfcId, "DFC:startDate": startDateStr, "DFC:expiryDate": expireDateStr, - "DFC:quantity": item['itemQty'], + "DFC:quantity": float(item['itemQty']), "DFC:price": priceStr, "DFC:Image": item['imageUrl'], "DFC:description": description @@ -1307,7 +1307,7 @@ def _dfcToSharesFormat(catalogJson: {}, "displayName": item['DFC:description'].split(':')[0], "summary": description, "imageUrl": item['DFC:Image'], - "itemQty": item['DFC:quantity'], + "itemQty": float(item['DFC:quantity']), "dfcId": dfcId, "itemType": itemType, "category": itemCategory,