mirror of
https://github.com/marcel-dempers/docker-development-youtube-series.git
synced 2025-06-06 17:01:30 +00:00
updates
This commit is contained in:
parent
2f778931f3
commit
976e397c1f
@ -19,9 +19,13 @@ def getCustomers():
|
|||||||
else:
|
else:
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
def updateCustomers(customer):
|
def getCustomer(customerID):
|
||||||
|
customer = getCustomers()
|
||||||
|
return customer[customerID]
|
||||||
|
|
||||||
|
def updateCustomers(customers):
|
||||||
with open('customers.json', 'w', newline='') as customerFile:
|
with open('customers.json', 'w', newline='') as customerFile:
|
||||||
customerJSON = json.dumps(customer)
|
customerJSON = json.dumps(customers)
|
||||||
customerFile.write(customerJSON)
|
customerFile.write(customerJSON)
|
||||||
|
|
||||||
customers = {
|
customers = {
|
||||||
@ -35,16 +39,15 @@ customers = {
|
|||||||
"h" : Customer("h", "Marcel", "Dempers")
|
"h" : Customer("h", "Marcel", "Dempers")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
customerDict = {}
|
customerDict = {}
|
||||||
|
|
||||||
for id in customers:
|
for id in customers:
|
||||||
customerDict[id] = customers[id].__dict__
|
customerDict[id] = customers[id].__dict__
|
||||||
|
|
||||||
|
|
||||||
updateCustomers(customerDict)
|
updateCustomers(customerDict)
|
||||||
|
|
||||||
customers = getCustomers()
|
customers = getCustomers()
|
||||||
|
customers["i"] = Customer("i", "Bob", "Smith").__dict__
|
||||||
|
|
||||||
customers["i"] = Customer("i", "Marcel", "Dempers").__dict__
|
|
||||||
updateCustomers(customers)
|
updateCustomers(customers)
|
||||||
|
|
||||||
print(customers)
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user