Changeset 8617 for branches/gajim_0.11.1/src/common
- Timestamp:
- 08/30/07 01:27:32 (15 months ago)
- Location:
- branches/gajim_0.11.1/src/common
- Files:
-
- 4 modified
-
connection_handlers.py (modified) (8 diffs)
-
connection.py (modified) (2 diffs)
-
exceptions.py (modified) (1 diff)
-
logger.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/gajim_0.11.1/src/common/connection_handlers.py
r8611 r8617 35 35 from common import gajim 36 36 from common import atom 37 from common import exceptions 37 38 from common.commands import ConnectionCommands 38 39 from common.pubsub import ConnectionPubSub … … 870 871 else: 871 872 path_to_file = path 872 fil = open(path_to_file, 'w') 873 fil.write(str(card)) 874 fil.close() 873 try: 874 fil = open(path_to_file, 'w') 875 fil.write(str(card)) 876 fil.close() 877 except IOError, e: 878 self.dispatch('ERROR', (_('Disk Write Error'), str(e))) 875 879 876 880 def get_cached_vcard(self, fjid, is_fake_jid = False): … … 1456 1460 msgtxt = None 1457 1461 if self.name not in no_log_for: 1458 gajim.logger.write('error', frm, error_msg, tim = tim, 1459 subject = subject) 1462 try: 1463 gajim.logger.write('error', frm, error_msg, tim = tim, 1464 subject = subject) 1465 except exceptions.PysqliteOperationalError, e: 1466 self.dispatch('ERROR', (_('Disk Write Error'), str(e))) 1460 1467 self.dispatch('MSGERROR', (frm, msg.getErrorCode(), error_msg, msgtxt, 1461 1468 tim)) … … 1476 1483 if self.name not in no_log_for and not int(float(time.mktime(tim)))\ 1477 1484 <= self.last_history_line[jid] and msgtxt: 1478 gajim.logger.write('gc_msg', frm, msgtxt, tim = tim) 1485 try: 1486 gajim.logger.write('gc_msg', frm, msgtxt, tim = tim) 1487 except exceptions.PysqliteOperationalError, e: 1488 self.dispatch('ERROR', (_('Disk Write Error'), str(e))) 1479 1489 return 1480 1490 elif mtype == 'chat': # it's type 'chat' … … 1483 1493 if msg.getTag('body') and self.name not in no_log_for and jid not in\ 1484 1494 no_log_for and msgtxt: 1485 msg_id = gajim.logger.write('chat_msg_recv', frm, msgtxt, tim = tim, 1486 subject = subject) 1495 try: 1496 msg_id = gajim.logger.write('chat_msg_recv', frm, msgtxt, 1497 tim = tim, subject = subject) 1498 except exceptions.PysqliteOperationalError, e: 1499 self.dispatch('ERROR', (_('Disk Write Error'), str(e))) 1487 1500 else: # it's single message 1488 1501 if invite is not None: … … 1495 1508 return 1496 1509 if self.name not in no_log_for and jid not in no_log_for and msgtxt: 1497 gajim.logger.write('single_msg_recv', frm, msgtxt, tim = tim, 1498 subject = subject) 1510 try: 1511 gajim.logger.write('single_msg_recv', frm, msgtxt, tim = tim, 1512 subject = subject) 1513 except exceptions.PysqliteOperationalError, e: 1514 self.dispatch('ERROR', (_('Disk Write Error'), str(e))) 1499 1515 mtype = 'normal' 1500 1516 treat_as = gajim.config.get('treat_incoming_messages') … … 1648 1664 # we know real jid, save it in db 1649 1665 st += ' (%s)' % jid 1650 gajim.logger.write('gcstatus', who, st, show) 1666 try: 1667 gajim.logger.write('gcstatus', who, st, show) 1668 except exceptions.PysqliteOperationalError, e: 1669 self.dispatch('ERROR', (_('Disk Write Error'), str(e))) 1651 1670 if avatar_sha or avatar_sha == '': 1652 1671 if avatar_sha == '': … … 1756 1775 self.request_vcard(jid_stripped) 1757 1776 if not ptype or ptype == 'unavailable': 1758 if gajim.config.get('log_contact_status_changes') and self.name\ 1759 not in no_log_for and jid_stripped not in no_log_for: 1760 gajim.logger.write('status', jid_stripped, status, show) 1777 if gajim.config.get('log_contact_status_changes') and self.name \ 1778 not in no_log_for and jid_stripped not in no_log_for: 1779 try: 1780 gajim.logger.write('status', jid_stripped, status, show) 1781 except exceptions.PysqliteOperationalError, e: 1782 self.dispatch('ERROR', (_('Disk Write Error'), str(e))) 1761 1783 self.dispatch('NOTIFY', (jid_stripped, show, status, resource, prio, 1762 1784 keyID, timestamp)) -
branches/gajim_0.11.1/src/common/connection.py
r8608 r8617 37 37 from common import GnuPG 38 38 from common import passwords 39 from common import exceptions 39 40 40 41 from connection_handlers import * … … 782 783 else: 783 784 kind = 'single_msg_sent' 784 gajim.logger.write(kind, jid, log_msg) 785 try: 786 gajim.logger.write(kind, jid, log_msg) 787 except exceptions.PysqliteOperationalError, e: 788 self.dispatch('ERROR', (_('Disk Write Error'), str(e))) 785 789 self.dispatch('MSGSENT', (jid, msg, keyID)) 786 790 -
branches/gajim_0.11.1/src/common/exceptions.py
r7130 r8617 21 21 def __str__(self): 22 22 return _('pysqlite2 (aka python-pysqlite2) dependency is missing. Exiting...') 23 24 class PysqliteOperationalError(Exception): 25 '''sqlite2 raised pysqlite2.dbapi2.OperationalError''' 26 def __init__(self, text=''): 27 Exception.__init__(self) 28 self.text = text 29 30 def __str__(self): 31 return self.text 23 32 24 33 class ServiceNotAvailable(Exception): -
branches/gajim_0.11.1/src/common/logger.py
r8610 r8617 294 294 #print 'saving', values 295 295 sql = 'INSERT INTO logs (jid_id, contact_name, time, kind, show, message, subject) VALUES (?, ?, ?, ?, ?, ?, ?)' 296 self.cur.execute(sql, values) 296 try: 297 self.cur.execute(sql, values) 298 except sqlite.OperationalError, e: 299 raise exceptions.PysqliteOperationalError(str(e)) 297 300 message_id = None 298 301 try:
