Files
YMS/yms/model/storage.py
T

35 lines
814 B
Python

# SPDX-License-Identifier: WTFPL
from .dbrecord import DbRecord
from yms.lookup import Table
# names for fixed dropdown values
GENERIC = 0
TANK = 1
EXT = 2
class Storage(DbRecord):
table = "storage"
pk_field = "sid"
fields = ('vid', 'sname', 'stype', 'capacity', 'capaunit',
'x', 'y', 'z', 'wx', 'wy', 'wz', 'angle', 'color', 'remarks')
def __init__(self, db, sid=None):
super().__init__(db, sid)
self.title = _("Storage({})")
def save(self, commit=True):
if not super().save(Table.STORAGE):
return False
if commit:
try:
self.conn.commit()
except mariadb.Error as e:
return False
return True
def delete(self):
# there must be no associated data!
pass