mirror of
https://github.com/chillout2k/gulag.git
synced 2025-12-13 16:00:18 +00:00
fixes in DB module
This commit is contained in:
parent
70da565673
commit
a50740d60f
@ -35,7 +35,7 @@ class GulagDB:
|
|||||||
)
|
)
|
||||||
self.uri_prefixes = uri_prefixes
|
self.uri_prefixes = uri_prefixes
|
||||||
except mariadb.Error as e:
|
except mariadb.Error as e:
|
||||||
raise GulagDBException(whoami(self) + e) from e
|
raise GulagDBException(whoami(self) + str(e)) from e
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
self.conn.close()
|
self.conn.close()
|
||||||
@ -59,7 +59,7 @@ class GulagDB:
|
|||||||
results[value] = True
|
results[value] = True
|
||||||
return results
|
return results
|
||||||
except mariadb.Error as e:
|
except mariadb.Error as e:
|
||||||
raise GulagDBException(whoami(self) + e) from e
|
raise GulagDBException(whoami(self) + str(e)) from e
|
||||||
|
|
||||||
def get_limit_clause(self,args):
|
def get_limit_clause(self,args):
|
||||||
if('query_offset' in args and 'query_limit' in args):
|
if('query_offset' in args and 'query_limit' in args):
|
||||||
@ -120,7 +120,7 @@ class GulagDB:
|
|||||||
continue
|
continue
|
||||||
return results
|
return results
|
||||||
except mariadb.Error as e:
|
except mariadb.Error as e:
|
||||||
raise GulagDBException(whoami(self) + e) from e
|
raise GulagDBException(whoami(self) + str(e)) from e
|
||||||
|
|
||||||
def get_mailbox(self,mailbox_id):
|
def get_mailbox(self,mailbox_id):
|
||||||
try:
|
try:
|
||||||
@ -144,7 +144,7 @@ class GulagDB:
|
|||||||
except MailboxException as e:
|
except MailboxException as e:
|
||||||
raise GulagDBException(whoami(self) + e.message) from e
|
raise GulagDBException(whoami(self) + e.message) from e
|
||||||
except mariadb.Error as e:
|
except mariadb.Error as e:
|
||||||
raise GulagDBException(whoami(self) + e) from e
|
raise GulagDBException(whoami(self) + str(e)) from e
|
||||||
|
|
||||||
def add_quarmail(self, quarmail):
|
def add_quarmail(self, quarmail):
|
||||||
try:
|
try:
|
||||||
@ -165,7 +165,7 @@ class GulagDB:
|
|||||||
cursor.close()
|
cursor.close()
|
||||||
return id
|
return id
|
||||||
except mariadb.Error as e:
|
except mariadb.Error as e:
|
||||||
raise GulagDBException(whoami(self) + e) from e
|
raise GulagDBException(whoami(self) + (e)) from e
|
||||||
|
|
||||||
def del_quarmail(self, id):
|
def del_quarmail(self, id):
|
||||||
try:
|
try:
|
||||||
@ -174,7 +174,7 @@ class GulagDB:
|
|||||||
cursor.close()
|
cursor.close()
|
||||||
return True
|
return True
|
||||||
except mariadb.Error as e:
|
except mariadb.Error as e:
|
||||||
raise GulagDBException(whoami(self) + e) from e
|
raise GulagDBException(whoami(self) + str(e)) from e
|
||||||
|
|
||||||
def get_quarmails(self,args):
|
def get_quarmails(self,args):
|
||||||
try:
|
try:
|
||||||
@ -203,7 +203,7 @@ class GulagDB:
|
|||||||
except GulagDBException as e:
|
except GulagDBException as e:
|
||||||
raise GulagDBException(whoami(self) + e.message) from e
|
raise GulagDBException(whoami(self) + e.message) from e
|
||||||
except mariadb.Error as e:
|
except mariadb.Error as e:
|
||||||
raise GulagDBException(whoami(self) + e) from e
|
raise GulagDBException(whoami(self) + str(e)) from e
|
||||||
|
|
||||||
def get_quarmail(self,args):
|
def get_quarmail(self,args):
|
||||||
try:
|
try:
|
||||||
@ -235,7 +235,7 @@ class GulagDB:
|
|||||||
# pass
|
# pass
|
||||||
return QuarMail(dict).__dict__
|
return QuarMail(dict).__dict__
|
||||||
except mariadb.Error as e:
|
except mariadb.Error as e:
|
||||||
raise GulagDBException(whoami(self) + e) from e
|
raise GulagDBException(whoami(self) + str(e)) from e
|
||||||
|
|
||||||
def get_deprecated_mails(self,retention_period):
|
def get_deprecated_mails(self,retention_period):
|
||||||
try:
|
try:
|
||||||
@ -255,7 +255,7 @@ class GulagDB:
|
|||||||
results.append(dict)
|
results.append(dict)
|
||||||
return results
|
return results
|
||||||
except mariadb.Error as e:
|
except mariadb.Error as e:
|
||||||
raise GulagDBException(whoami(self) + e) from e
|
raise GulagDBException(whoami(self) + str(e)) from e
|
||||||
|
|
||||||
def add_attachment(self, attach):
|
def add_attachment(self, attach):
|
||||||
try:
|
try:
|
||||||
@ -266,7 +266,7 @@ class GulagDB:
|
|||||||
)
|
)
|
||||||
return cursor.lastrowid
|
return cursor.lastrowid
|
||||||
except mariadb.Error as e:
|
except mariadb.Error as e:
|
||||||
raise GulagDBException(whoami(self) + e) from e
|
raise GulagDBException(whoami(self) + str(e)) from e
|
||||||
|
|
||||||
def get_attachments(self):
|
def get_attachments(self):
|
||||||
try:
|
try:
|
||||||
@ -290,7 +290,7 @@ class GulagDB:
|
|||||||
results.append(Attachment(dict).__dict__)
|
results.append(Attachment(dict).__dict__)
|
||||||
return results
|
return results
|
||||||
except mariadb.Error as e:
|
except mariadb.Error as e:
|
||||||
raise GulagDBException(whoami(self) + e) from e
|
raise GulagDBException(whoami(self) + str(e)) from e
|
||||||
|
|
||||||
def get_attachment(self, args):
|
def get_attachment(self, args):
|
||||||
try:
|
try:
|
||||||
@ -314,7 +314,7 @@ class GulagDB:
|
|||||||
dict['href'] = self.uri_prefixes['attachments'] + str(dict['id'])
|
dict['href'] = self.uri_prefixes['attachments'] + str(dict['id'])
|
||||||
return Attachment(dict).__dict__
|
return Attachment(dict).__dict__
|
||||||
except mariadb.Error as e:
|
except mariadb.Error as e:
|
||||||
raise GulagDBException(whoami(self) + e) from e
|
raise GulagDBException(whoami(self) + str(e)) from e
|
||||||
|
|
||||||
def get_quarmail_attachments(self,quarmail_id):
|
def get_quarmail_attachments(self,quarmail_id):
|
||||||
try:
|
try:
|
||||||
@ -341,7 +341,7 @@ class GulagDB:
|
|||||||
results.append(Attachment(dict).__dict__)
|
results.append(Attachment(dict).__dict__)
|
||||||
return results
|
return results
|
||||||
except mariadb.Error as e:
|
except mariadb.Error as e:
|
||||||
raise GulagDBException(whoami(self) + e) from e
|
raise GulagDBException(whoami(self) + str(e)) from e
|
||||||
|
|
||||||
def get_quarmail_attachment(self,quarmail_id,attachment_id):
|
def get_quarmail_attachment(self,quarmail_id,attachment_id):
|
||||||
try:
|
try:
|
||||||
@ -367,7 +367,7 @@ class GulagDB:
|
|||||||
dict['href'] += "/attachments/" + str(dict['id'])
|
dict['href'] += "/attachments/" + str(dict['id'])
|
||||||
return Attachment(dict).__dict__
|
return Attachment(dict).__dict__
|
||||||
except mariadb.Error as e:
|
except mariadb.Error as e:
|
||||||
raise GulagDBException(whoami(self) + e) from e
|
raise GulagDBException(whoami(self) + str(e)) from e
|
||||||
|
|
||||||
|
|
||||||
def quarmail2attachment(self,quarmail_id,attachment_id):
|
def quarmail2attachment(self,quarmail_id,attachment_id):
|
||||||
@ -378,5 +378,5 @@ class GulagDB:
|
|||||||
(quarmail_id, attachment_id)
|
(quarmail_id, attachment_id)
|
||||||
)
|
)
|
||||||
except mariadb.Error as e:
|
except mariadb.Error as e:
|
||||||
raise GulagDBException(whoami(self) + e) from e
|
raise GulagDBException(whoami(self) + str(e)) from e
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user