Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Unified Diff: third_party/twisted_8_1/twisted/web/monitor.py

Issue 12261012: Remove third_party/twisted_8_1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/twisted_8_1/twisted/web/microdom.py ('k') | third_party/twisted_8_1/twisted/web/proxy.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/twisted_8_1/twisted/web/monitor.py
diff --git a/third_party/twisted_8_1/twisted/web/monitor.py b/third_party/twisted_8_1/twisted/web/monitor.py
deleted file mode 100644
index 052e94c3b4cbbb7373f53009713cee5b2f90ba27..0000000000000000000000000000000000000000
--- a/third_party/twisted_8_1/twisted/web/monitor.py
+++ /dev/null
@@ -1,85 +0,0 @@
-# Copyright (c) 2001-2004 Twisted Matrix Laboratories.
-# See LICENSE for details.
-
-#
-from twisted.web import client
-from twisted.internet import reactor
-import md5
-from zope.interface import implements
-
-class IChangeNotified:
- pass
-
-class BaseChangeNotified:
-
- implements(IChangeNotified)
-
- def reportChange(self, old, new):
- pass
-
- def reportNoChange(self):
- pass
-
-class ChangeChecker:
-
- working = 0
- call = None
-
- def __init__(self, notified, url, delay=60):
- self.notified = notified
- self.url = url
- self.md5 = None
- self.delay = delay
-
- def start(self):
- self.working = 1
- self._getPage()
-
- def stop(self):
- if self.call:
- self.call.cancel()
- self.call = None
- self.working = 0
-
- def _getPage(self):
- d = client.getPage(self.url)
- d.addErrback(self.noPage)
- d.addCallback(self.page)
- self.call = None
-
- def noPage(self, e):
- self.gotMD5(None)
-
- def page(self, p):
- if p is None:
- return self.gotMD5(None)
- m = md5.new()
- m.update(p)
- self.gotMD5(m.digest())
-
- def gotMD5(self, md5):
- if not self.working:
- return
- if md5 != self.md5:
- self.notified.reportChange(self.md5, md5)
- self.md5 = md5
- else:
- self.notified.reportNoChange()
- if not self.call:
- self.call = reactor.callLater(self.delay, self._getPage)
-
-
-class ProxyChangeChecker(ChangeChecker):
-
- def __init__(self, proxyHost, proxyPort, notified, url, delay=60):
- self.proxyHost = proxyHost
- self.proxyPort = proxyPort
- ChangeChecker.__init__(self, notified, url, delay)
-
- def _getPage(self):
- factory = client.HTTPClientFactory(self.proxyHost, self.url)
- factory.headers = {'pragma': 'no-cache'}
- reactor.connectTCP(self.proxyHost, self.proxyPort, factory)
- d = factory.deferred
- d.addErrback(self.noPage)
- d.addCallback(self.page)
« no previous file with comments | « third_party/twisted_8_1/twisted/web/microdom.py ('k') | third_party/twisted_8_1/twisted/web/proxy.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698