|
@@ -20,6 +20,7 @@ import socket
|
|
|
import sys
|
|
|
import time
|
|
|
import threading
|
|
|
+import traceback
|
|
|
import urllib, urllib2
|
|
|
import urlparse
|
|
|
import warnings
|
|
@@ -299,14 +300,14 @@ class LocationBot(ircbot.SingleServerIRCBot):
|
|
|
try:
|
|
|
updated, coordinates, accuracy, speed, heading, altitude, altitude_accuracy, new_location = self.__latitude(granularity, token, secret)
|
|
|
except Exception, error:
|
|
|
- print error
|
|
|
+ traceback.print_exc()
|
|
|
continue
|
|
|
|
|
|
cursor.execute('update locationbot.nick set granularity = %s, location = %s, coordinates = point %s, accuracy = %s, speed = %s, heading = %s, altitude = %s, altitude_accuracy = %s, updated = %s where nick = %s', (granularity, new_location, coordinates, accuracy, speed, heading, altitude, altitude_accuracy, updated, nick))
|
|
|
db.commit()
|
|
|
self.__location(nick, channels, granularity, old_location, new_location, coordinates, accuracy, speed, heading, altitude, altitude_accuracy)
|
|
|
except psycopg2.Error, error:
|
|
|
- print error
|
|
|
+ traceback.print_exc()
|
|
|
|
|
|
with self.__latitude_timer_lock:
|
|
|
self.__latitude_timer = threading.Timer((self.__latitude_next - datetime.utcnow()).seconds, self.__latitude)
|
|
@@ -716,8 +717,7 @@ class LocationBot(ircbot.SingleServerIRCBot):
|
|
|
ircbot.SingleServerIRCBot.disconnect(self, message)
|
|
|
|
|
|
def error(self, error):
|
|
|
- print error
|
|
|
-
|
|
|
+ traceback.print_exc()
|
|
|
self.connection.privmsg(self.__nick, 'an error occured')
|
|
|
|
|
|
def get_version(self):
|
|
@@ -796,8 +796,7 @@ class LocationBot(ircbot.SingleServerIRCBot):
|
|
|
else:
|
|
|
self.__unknown(connection, nick, command)
|
|
|
except Exception, error:
|
|
|
- print error
|
|
|
-
|
|
|
+ traceback.print_exc()
|
|
|
connection.privmsg(nick, 'an error occurred')
|
|
|
|
|
|
def on_quit(self, connection, event):
|
|
@@ -946,9 +945,10 @@ def _heading_to_direction(heading):
|
|
|
return 'NNW'
|
|
|
|
|
|
def _or(function, values):
|
|
|
- for value in values:
|
|
|
- if function(value):
|
|
|
- return True
|
|
|
+ if values:
|
|
|
+ for value in values:
|
|
|
+ if function(value):
|
|
|
+ return True
|
|
|
|
|
|
return False
|
|
|
|