26 lines
674 B
Python
26 lines
674 B
Python
# SPDX-License-Identifier: WTFPL
|
|
|
|
from .dbrecord import DbRecord
|
|
from yms.lookup import Table
|
|
|
|
class Fuse(DbRecord):
|
|
|
|
table = "fuse"
|
|
pk_field = "fuseid"
|
|
fields = ('fuseid', 'vid', 'fnumber', 'ftype', 'current', 'cableid',
|
|
'eid', 'location', 'description', 'color', 'remarks')
|
|
|
|
def __init__(self, db, fuseid=None):
|
|
super().__init__(db, fuseid)
|
|
self.title = _("Fuse({})")
|
|
|
|
def save(self, commit=True):
|
|
if not super().save(Table.FUSES):
|
|
return False
|
|
if commit:
|
|
try:
|
|
self.conn.commit()
|
|
except mariadb.Error as e:
|
|
return False
|
|
return True
|