From 02a12fe304da59c6a68071af0c8587270870803d Mon Sep 17 00:00:00 2001 From: RaNaN Date: Wed, 29 Dec 2010 13:28:16 +0100 Subject: better cleanup --- module/network/Browser.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'module/network/Browser.py') diff --git a/module/network/Browser.py b/module/network/Browser.py index 19b6aca66..3a8cd94a0 100644 --- a/module/network/Browser.py +++ b/module/network/Browser.py @@ -22,7 +22,10 @@ class Browser(object): self.http = HTTPRequest(self.cj, interface, proxies) self.dl = None + # tunnel some attributes from HTTP Request to Browser lastEffectiveURL = property(lambda self: self.http.lastEffectiveURL) + lastURL = property(lambda self: self.http.lastURL) + code = property(lambda self: self.http.code) def setCookieJar(self, cj): self.cj = cj @@ -56,9 +59,10 @@ class Browser(object): def clearCookies(self): if self.cj: self.cj.clear() + self.http.clearCookies() def clearReferer(self): - self.lastURL = None + self.http.lastURL = None def abortDownloads(self): self.http.abort = True @@ -66,6 +70,7 @@ class Browser(object): self.dl.abort = True def httpDownload(self, url, filename, get={}, post={}, ref=True, cookies=True, chunks=1, resume=False): + """ this can also download ftp """ self.dl = HTTPDownload(url, filename, get, post, self.lastEffectiveURL if ref else None, self.cj if cookies else None, self.bucket, self.interface, self.proxies) @@ -85,7 +90,7 @@ class Browser(object): """ retrieves page """ return self.http.load(url, get, post, ref, cookies, just_header) - def clean(self): + def close(self): """ cleanup """ if hasattr(self, "http"): self.http.close() -- cgit v1.2.3