-def userDelResource(request):
- spawnThread(request, 'userdelresource', 'User removed resource from slice')
+ #trying to connect local db adn pull unsent logs
+ try:
+ conn = lite.connect(dbfile)
+ cur = conn.cursor()
+ cur.execute("SELECT rowid, log from logs")
+ notsent = cur.fetchall()
+ for row in notsent:
+ #trying to send unsent data from sqlite db
+ try :
+ urllib2.urlopen(config.activity.server, urllib.urlencode(json.loads(row[1])))
+ #delete those who were sent
+ cur.execute("""DELETE FROM logs where rowid = %s""" % row[0] )
+ conn.commit()
+ except urllib2.URLError as e:
+ # this is just to inform that DB is not working properly
+ logger.error('[activity] Error while sending stats')
+ logger.error(e.strerror)