# SPDX-License-Identifier: WTFPL from .dbrecord import DbRecord class Document(DbRecord): table = "document" pk_field = "docid" fields = ('doctype', 'mimetype', 'filename', 'extension', 'hash', 'docsize', 'doctime', 'docdate', 'title', 'pages', 'remarks', 'roleaccess') def __init__(self, db, docid=None): super().__init__(db, docid) self.title = _("Document({})") def save(self, commit=True): if not super().save(): return False if commit: try: self.conn.commit() except mariadb.Error as e: return False return True