MCPcopy Create free account
hub / github.com/ndleah/python-mini-project / add_product

Method add_product

Sqlite-crud/main.py:91–101  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

89 return len(self.name.get()) != 0 and len(self.price.get()) != 0
90
91 def add_product(self):
92 if self.validation():
93 query = 'INSERT INTO product VALUES(NULL, ?, ?)'
94 parameters = (self.name.get(), self.price.get())
95 self.run_query(query, parameters)
96 self.message['text'] = 'Product {} added Successfully'.format(self.name.get())
97 self.name.delete(0, END)
98 self.price.delete(0, END)
99 else:
100 self.message['text'] = 'Name and Price is Required'
101 self.get_products()
102
103 def delete_product(self):
104 self.message['text'] = ''

Callers

nothing calls this directly

Calls 4

validationMethod · 0.95
run_queryMethod · 0.95
get_productsMethod · 0.95
formatMethod · 0.80

Tested by

no test coverage detected