27 lines
697 B
Python
27 lines
697 B
Python
# SPDX-License-Identifier: WTFPL
|
|
|
|
from .dbrecord import DbRecord
|
|
|
|
class Document(DbRecord):
|
|
|
|
table = "document"
|
|
pk_field = "docid"
|
|
pk_is_auto = True
|
|
fields = ('docid', '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
|