Files
YMS/yms/model/cable.py
T

28 lines
769 B
Python

# SPDX-License-Identifier: WTFPL
from .dbrecord import DbRecord
from yms.lookup import Table
class Cable(DbRecord):
table = "cable"
pk_field = "cableid"
pk_is_auto = True
fields = ('cableid', 'vid', 'cablename', 'cabletype', 'techname',
'length', 'conductors', 'diameter', 'xsection', 'weight', 'color',
'supplier', 'manufacturer', 'cablecond', 'remarks')
def __init__(self, db, cableid=None):
super().__init__(db, cableid)
self.title = _("Cable({})")
def save(self, commit=True):
if not super().save(Table.CABLES):
return False
if commit:
try:
self.conn.commit()
except mariadb.Error as e:
return False
return True