[nanny] Some exceptions catched
- From: Roberto Majadas <telemaco src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nanny] Some exceptions catched
- Date: Sun, 23 Jan 2011 18:07:03 +0000 (UTC)
commit a4ccff1fe40aeea32f150b80b566ee242c3f1d6f
Author: Roberto Majadas <roberto majadas openshine com>
Date: Mon Jan 10 04:08:53 2011 +0100
Some exceptions catched
daemon/src/proxy/TwistedProxy.py | 57 ++++++++++++++++++++++----------------
1 files changed, 33 insertions(+), 24 deletions(-)
---
diff --git a/daemon/src/proxy/TwistedProxy.py b/daemon/src/proxy/TwistedProxy.py
index 5720cde..db23f37 100644
--- a/daemon/src/proxy/TwistedProxy.py
+++ b/daemon/src/proxy/TwistedProxy.py
@@ -120,23 +120,26 @@ class BadBoyResponseFilterImage(BadBoyResponseFilter) :
BadBoyResponseFilter.__init__(self, client)
def filter(self):
- im = Image.open(self.fd_orig)
- im_format = im.format
-
- draw = ImageDraw.Draw(im)
try:
- draw.rectangle((0, 0) + im.size, fill="#FFFFFF")
- except:
+ im = Image.open(self.fd_orig)
+ im_format = im.format
+
+ draw = ImageDraw.Draw(im)
try:
- draw.rectangle((0, 0) + im.size, fill="255")
+ draw.rectangle((0, 0) + im.size, fill="#FFFFFF")
except:
- pass
-
- draw.line((0, 0) + im.size, fill=128, width=10)
- draw.line((0, im.size[1], im.size[0], 0), fill=128, width=10)
- del draw
+ try:
+ draw.rectangle((0, 0) + im.size, fill="255")
+ except:
+ pass
- im.save(self.fd_filtered, im_format)
+ draw.line((0, 0) + im.size, fill=128, width=10)
+ draw.line((0, im.size[1], im.size[0], 0), fill=128, width=10)
+ del draw
+
+ im.save(self.fd_filtered, im_format)
+ except:
+ pass
class BadBoyProxyClient(proxy.ProxyClient) :
def connectionMade(self):
@@ -169,7 +172,10 @@ class BadBoyProxyClient(proxy.ProxyClient) :
if self.bb_response == None:
self.father.setResponseCode(404)
self.father.write(BAD_WEB_TEMPLATE)
- proxy.ProxyClient.handleResponseEnd(self)
+ try:
+ proxy.ProxyClient.handleResponseEnd(self)
+ except:
+ pass
def handleResponsePart(self, data):
if self.bb_response != None:
@@ -287,16 +293,19 @@ class ReverseProxyResource(resource.Resource) :
host = data[3]
port = data[4]
- if is_ok :
- clientFactory = self.proxyClientFactoryClass(
- self.request.method, rest, request.clientproto,
- request.getAllHeaders(), request.content.read(), request)
- self.reactor.connectTCP(host, port, clientFactory)
- else:
- clientFactory = BadBoyProxyClientFactory(
- self.request.method, rest, request.clientproto,
- request.getAllHeaders(), request.content.read(), request)
- self.reactor.connectTCP(host, port, clientFactory)
+ try:
+ if is_ok :
+ clientFactory = self.proxyClientFactoryClass(
+ self.request.method, rest, request.clientproto,
+ request.getAllHeaders(), request.content.read(), request)
+ self.reactor.connectTCP(host, port, clientFactory)
+ else:
+ clientFactory = BadBoyProxyClientFactory(
+ self.request.method, rest, request.clientproto,
+ request.getAllHeaders(), request.content.read(), request)
+ self.reactor.connectTCP(host, port, clientFactory)
+ except:
+ print "Validate_cb except "
def __get_host_info(self, request):
host = None
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]