Esempio n. 1
0
def handleTraceback(object):
    context = object.context
    entry_url = object.entry_url

    if entry_url is None:
        return

    log("handle traceback [%s]" % entry_url)
    try:
        cleanup_lock.acquire()
        # we don't want to produce any errors here, thus, we'll be nice and die
        # silently if an error occurs here
        try:
            transaction.begin()
            # get our logbook view to use the api
            logbook = context.unrestrictedTraverse('@@logbook')
            # get the generated error url from Products.SiteErrorLog
            err_id = urllib.splitvalue(entry_url)[1]
            # save error
            logbook.save_error(err_id, context=aq_base(aq_parent(context)))
            transaction.get().note('collective.logbook traceback [%s]' %
                                   entry_url)
            transaction.commit()
        finally:
            cleanup_lock.release()
    # only warning
    except Exception, e:
        log("An error occured while handling the traceback", level="warning")
        log("%s" % e, level="warning")
        LOGGER.exception(e)
Esempio n. 2
0
 def run(self):
     try:
         self.data = urllib.urlencode(self.data)
         r = urllib2.urlopen(self.url, self.data)
         r.read()
     except Exception as e:
         LOGGER.error(e)
         LOGGER.exception(e)
Esempio n. 3
0
 def run(self):
     orignal_timeout = socket.getdefaulttimeout()
     try:
         self.data = urllib.urlencode(self.data)
         socket.setdefaulttimeout(WEBHOOK_HTTP_TIMEOUT)
         r = urllib2.urlopen(self.url, self.data)
         r.read()
     except Exception as e:
         logger.error(e)
         logger.exception(e)
     finally:
         socket.setdefaulttimeout(orignal_timeout)