rem
stringlengths
1
322k
add
stringlengths
0
2.05M
context
stringlengths
4
228k
meta
stringlengths
156
215
self.filt("""<script src="
self.filt("""<script src="http://ivwbox.de"></script>""", "")
def testFilter (self): self.filt("""<script src="#ivwbox.de"></script>""", "")
68899b51a56d2ab2230acc59f361f21a6494f2fa /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/68899b51a56d2ab2230acc59f361f21a6494f2fa/test_rewritescript.py
print "XXX read"
def rawrequest3 (url, port): """raw request with proxy CONNECT protocol""" from wc.proxy.Dispatcher import create_socket from urllib import splitnport parts = urlparse.urlsplit(url) host, sslport = splitnport(parts[1], 443) path = urlparse.urlunsplit(('', '', parts[2], parts[3], parts[4])) _sock = create_socket(socket....
be161445026098c6100b9ce2201594c86781541a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/be161445026098c6100b9ce2201594c86781541a/getssl.py
print "Oops"
if msg[0] != 6: print "Oops", msg
def rawrequest3 (url, port): """raw request with proxy CONNECT protocol""" from wc.proxy.Dispatcher import create_socket from urllib import splitnport parts = urlparse.urlsplit(url) host, sslport = splitnport(parts[1], 443) path = urlparse.urlunsplit(('', '', parts[2], parts[3], parts[4])) _sock = create_socket(socket....
be161445026098c6100b9ce2201594c86781541a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/be161445026098c6100b9ce2201594c86781541a/getssl.py
ratings.clear()
def _reset_ratings (): ratings.clear() for category, catdata in service['categories'].items(): if catdata['rvalues']: ratings[category] = catdata['rvalues'][0] else: ratings[category] = "" values.clear() for category, value in ratings.items(): if category not in ["generic", "modified"]: values[category] = {value: True}...
bfc4984cb80cf8fabc9960826812d18008675f28 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/bfc4984cb80cf8fabc9960826812d18008675f28/rating_html.py
values.clear() for category, value in ratings.items(): if category not in ["generic", "modified"]: values[category] = {value: True}
values[category] = {} for value in catdata['rvalues']: values[category][value] = False
def _reset_ratings (): ratings.clear() for category, catdata in service['categories'].items(): if catdata['rvalues']: ratings[category] = catdata['rvalues'][0] else: ratings[category] = "" values.clear() for category, value in ratings.items(): if category not in ["generic", "modified"]: values[category] = {value: True}...
bfc4984cb80cf8fabc9960826812d18008675f28 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/bfc4984cb80cf8fabc9960826812d18008675f28/rating_html.py
info = {} error = {} ratings = {} values = {} rating_modified = {}
def _calc_ratings_display (): global ratings_display urls = rating_cache.keys() urls.sort() ratings_display = urls[curindex:curindex+_entries_per_page] for _url in ratings_display: t = _strtime(float(rating_cache[_url]['modified'])) rating_modified[_url] = t.replace(u" ", u"&nbsp;")
bfc4984cb80cf8fabc9960826812d18008675f28 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/bfc4984cb80cf8fabc9960826812d18008675f28/rating_html.py
info.clear() error.clear()
for key in info.keys(): info[key] = False for key in error.keys(): error[key] = False
def _form_reset (): info.clear() error.clear() _reset_ratings() global url, generic, curindex url = u"" generic = False curindex = 0
bfc4984cb80cf8fabc9960826812d18008675f28 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/bfc4984cb80cf8fabc9960826812d18008675f28/rating_html.py
script = escape_js(remove_html_comments(script)) if not jscomments: script = remove_js_comments(script)
script = escape_js(remove_html_comments(script, jscomments=jscomments))
def clean (script, jscomments=True): """ Clean script from comments and HTML. """ script = escape_js(remove_html_comments(script)) if not jscomments: script = remove_js_comments(script) return u"\n<!--\n%s\n//-->\n" % script
1be559507527d8ab8cf4c85c0653082cb57e6e8b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/1be559507527d8ab8cf4c85c0653082cb57e6e8b/__init__.py
def remove_whitespace (script): lines = [] for line in script.splitlines(): line = line.rstrip() if line: lines.append(line) return "\n".join(lines)
def clean (script, jscomments=True): """ Clean script from comments and HTML. """ script = escape_js(remove_html_comments(script)) if not jscomments: script = remove_js_comments(script) return u"\n<!--\n%s\n//-->\n" % script
1be559507527d8ab8cf4c85c0653082cb57e6e8b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/1be559507527d8ab8cf4c85c0653082cb57e6e8b/__init__.py
if script[i:i+9].lower() == '</script>' and quote: script = script[:i]+"</scr"+quote+"+"+quote+"ipt>"+\ script[(i+9):]
if script[i:i+9].lower() == '</script>': if quote: script = script[:i] + "</scr" + quote + "+" + \ quote + "ipt>" + script[(i+9):] else: script = script[:i] + script[(i+9):]
def escape_js_line (script): # if we encounter "</script>" in the script, we assume that is # in a quoted string. The solution is to split it into # "</scr"+"ipt>" (with the proper quotes of course) quote = False escape = False i = 0 while i < len(script): c = script[i] if c == '"' or c == "'": if not escape: if quote ...
1be559507527d8ab8cf4c85c0653082cb57e6e8b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/1be559507527d8ab8cf4c85c0653082cb57e6e8b/__init__.py
def remove_html_comments (script):
def remove_html_comments (script, jscomments=True):
def remove_html_comments (script): """ Remove leading and trailing HTML comments from the script text. """ script = remove_whitespace(script) mo = _start_js_comment(script) if mo: script = script[mo.end():] mo = _end_js_comment(script) if mo: if mo.group("comment") is not None: i = script.rindex("//") else: i = script....
1be559507527d8ab8cf4c85c0653082cb57e6e8b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/1be559507527d8ab8cf4c85c0653082cb57e6e8b/__init__.py
script = remove_whitespace(script)
lines = [] for line in script.splitlines(): line = line.rstrip() if line and (jscomments or not line.lstrip().startswith('//')): lines.append(line) script = "\n".join(lines)
def remove_html_comments (script): """ Remove leading and trailing HTML comments from the script text. """ script = remove_whitespace(script) mo = _start_js_comment(script) if mo: script = script[mo.end():] mo = _end_js_comment(script) if mo: if mo.group("comment") is not None: i = script.rindex("//") else: i = script....
1be559507527d8ab8cf4c85c0653082cb57e6e8b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/1be559507527d8ab8cf4c85c0653082cb57e6e8b/__init__.py
fp = gzip.GzipFile('', 'rb', 9, StringIO(content))
fp = gzip.GzipFile('', 'rb', 9, StringIO.StringIO(content))
def decode (page): "gunzip or deflate a compressed page" encoding = page.info().get("Content-Encoding") if encoding in ('gzip', 'x-gzip', 'deflate'): # cannot seek in socket descriptors, so must get content now content = page.read() if encoding == 'deflate': fp = StringIO.StringIO(zlib.decompress(content)) else: fp = g...
1e1981a11cc7b2970c193ace7a39298a83b5598a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/1e1981a11cc7b2970c193ace7a39298a83b5598a/update.py
self._debug("JS document.write %s", `data`)
def jsProcessData (self, data): """process data produced by document.write() JavaScript""" #self._debug("JS document.write %s", `data`) self.js_output += 1 # parse recursively self.js_html.feed(data)
b148e442fbaa41c0936bdbd1eac4f2a19641bc8c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/b148e442fbaa41c0936bdbd1eac4f2a19641bc8c/HtmlParser.py
self._debug("JS: popup")
def jsProcessPopup (self): """process javascript popup""" #self._debug("JS: popup") self.js_popup += 1
b148e442fbaa41c0936bdbd1eac4f2a19641bc8c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/b148e442fbaa41c0936bdbd1eac4f2a19641bc8c/HtmlParser.py
self._debug("buf_append_data")
def buf_append_data (self, data): """we have to make sure that we have no two following DATA things in the tag buffer. Why? To be 100% sure that an ENCLOSED match really matches enclosed data. """ #self._debug("buf_append_data") if data[0]==DATA and self.buf and self.buf[-1][0]==DATA: self.buf[-1][1] += data[1] else: s...
b148e442fbaa41c0936bdbd1eac4f2a19641bc8c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/b148e442fbaa41c0936bdbd1eac4f2a19641bc8c/HtmlParser.py
self._debug("flushbuf")
def flushbuf (self): """clear and return the output buffer""" #self._debug("flushbuf") data = self.outbuf.getvalue() self.outbuf.close() self.outbuf = StringIO() return data
b148e442fbaa41c0936bdbd1eac4f2a19641bc8c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/b148e442fbaa41c0936bdbd1eac4f2a19641bc8c/HtmlParser.py
self._debug("self.outbuf %s", `self.outbuf.getvalue()`) self._debug("self.buf %s", `self.buf`) self._debug("self.waitbuf %s", `self.waitbuf`) self._debug("self.inbuf %s", `self.inbuf.getvalue()`)
def _debugbuf (self): """print debugging information about data buffer status""" #self._debug("self.outbuf %s", `self.outbuf.getvalue()`) #self._debug("self.buf %s", `self.buf`) #self._debug("self.waitbuf %s", `self.waitbuf`) #self._debug("self.inbuf %s", `self.inbuf.getvalue()`)
b148e442fbaa41c0936bdbd1eac4f2a19641bc8c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/b148e442fbaa41c0936bdbd1eac4f2a19641bc8c/HtmlParser.py
self._debug("feed %s", `data`)
def feed (self, data): """feed some data to the parser""" if self.state=='parse': # look if we must replay something if self.waited: self.waited = 0 waitbuf, self.waitbuf = self.waitbuf, [] self.replay(waitbuf) if self.state!='parse': self.inbuf.write(data) return data = self.inbuf.getvalue() + data self.inbuf.close() ...
b148e442fbaa41c0936bdbd1eac4f2a19641bc8c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/b148e442fbaa41c0936bdbd1eac4f2a19641bc8c/HtmlParser.py
self._debug("feed")
def feed (self, data): """feed some data to the parser""" if self.state=='parse': # look if we must replay something if self.waited: self.waited = 0 waitbuf, self.waitbuf = self.waitbuf, [] self.replay(waitbuf) if self.state!='parse': self.inbuf.write(data) return data = self.inbuf.getvalue() + data self.inbuf.close() ...
b148e442fbaa41c0936bdbd1eac4f2a19641bc8c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/b148e442fbaa41c0936bdbd1eac4f2a19641bc8c/HtmlParser.py
self._debug("wait")
def feed (self, data): """feed some data to the parser""" if self.state=='parse': # look if we must replay something if self.waited: self.waited = 0 waitbuf, self.waitbuf = self.waitbuf, [] self.replay(waitbuf) if self.state!='parse': self.inbuf.write(data) return data = self.inbuf.getvalue() + data self.inbuf.close() ...
b148e442fbaa41c0936bdbd1eac4f2a19641bc8c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/b148e442fbaa41c0936bdbd1eac4f2a19641bc8c/HtmlParser.py
self._debug("flush")
def flush (self): #self._debug("flush") # flushing in wait state raises a filter exception if self.state=='wait': raise FilterWait("HtmlParser[%d]: waiting for data"%self.level) self.parser.flush()
b148e442fbaa41c0936bdbd1eac4f2a19641bc8c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/b148e442fbaa41c0936bdbd1eac4f2a19641bc8c/HtmlParser.py
self._debug("replay %s", `waitbuf`)
def replay (self, waitbuf): """call the handler functions again with buffer data""" #self._debug("replay %s", `waitbuf`) for item in waitbuf: if item[0]==DATA: self._data(item[1]) elif item[0]==STARTTAG: self.startElement(item[1], item[2]) elif item[0]==ENDTAG: self.endElement(item[1]) elif item[0]==COMMENT: self.comme...
b148e442fbaa41c0936bdbd1eac4f2a19641bc8c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/b148e442fbaa41c0936bdbd1eac4f2a19641bc8c/HtmlParser.py
self._debug("cdata %s", `data`)
def cdata (self, data): """character data""" #self._debug("cdata %s", `data`) return self._data(data)
b148e442fbaa41c0936bdbd1eac4f2a19641bc8c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/b148e442fbaa41c0936bdbd1eac4f2a19641bc8c/HtmlParser.py
self._debug("characters %s", `data`)
def characters (self, data): """characters""" #self._debug("characters %s", `data`) return self._data(data)
b148e442fbaa41c0936bdbd1eac4f2a19641bc8c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/b148e442fbaa41c0936bdbd1eac4f2a19641bc8c/HtmlParser.py
self._debug("comment %s", `data`)
def comment (self, data): """a comment; accept only non-empty comments""" #self._debug("comment %s", `data`) item = [COMMENT, data] if self.state=='wait': return self.waitbuf.append(item) if self.comments and data: self.buf.append(item)
b148e442fbaa41c0936bdbd1eac4f2a19641bc8c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/b148e442fbaa41c0936bdbd1eac4f2a19641bc8c/HtmlParser.py
self._debug("doctype %s", `data`)
def doctype (self, data): #self._debug("doctype %s", `data`) return self._data("<!DOCTYPE%s>"%data)
b148e442fbaa41c0936bdbd1eac4f2a19641bc8c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/b148e442fbaa41c0936bdbd1eac4f2a19641bc8c/HtmlParser.py
self._debug("pi %s", `data`)
def pi (self, data): #self._debug("pi %s", `data`) return self._data("<?%s?>"%data)
b148e442fbaa41c0936bdbd1eac4f2a19641bc8c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/b148e442fbaa41c0936bdbd1eac4f2a19641bc8c/HtmlParser.py
self._debug("startElement %s", `tag`)
def startElement (self, tag, attrs): """We get a new start tag. New rules could be appended to the pending rules. No rules can be removed from the list.""" # default data #self._debug("startElement %s", `tag`) tag = check_spelling(tag, self.url) item = [STARTTAG, tag, attrs] if self.state=='wait': return self.waitbuf.a...
b148e442fbaa41c0936bdbd1eac4f2a19641bc8c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/b148e442fbaa41c0936bdbd1eac4f2a19641bc8c/HtmlParser.py
self._debug("matched rule %s on tag %s", `rule.title`, `tag`)
def startElement (self, tag, attrs): """We get a new start tag. New rules could be appended to the pending rules. No rules can be removed from the list.""" # default data #self._debug("startElement %s", `tag`) tag = check_spelling(tag, self.url) item = [STARTTAG, tag, attrs] if self.state=='wait': return self.waitbuf.a...
b148e442fbaa41c0936bdbd1eac4f2a19641bc8c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/b148e442fbaa41c0936bdbd1eac4f2a19641bc8c/HtmlParser.py
self._debug("put on buffer")
def startElement (self, tag, attrs): """We get a new start tag. New rules could be appended to the pending rules. No rules can be removed from the list.""" # default data #self._debug("startElement %s", `tag`) tag = check_spelling(tag, self.url) item = [STARTTAG, tag, attrs] if self.state=='wait': return self.waitbuf.a...
b148e442fbaa41c0936bdbd1eac4f2a19641bc8c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/b148e442fbaa41c0936bdbd1eac4f2a19641bc8c/HtmlParser.py
self._debug("endElement %s", `tag`)
def endElement (self, tag): """We know the following: if a rule matches, it must be the one on the top of the stack. So we look only at the top rule.
b148e442fbaa41c0936bdbd1eac4f2a19641bc8c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/b148e442fbaa41c0936bdbd1eac4f2a19641bc8c/HtmlParser.py
self._debug("JS: del %s from %s", `name`, `tag`)
def jsStartElement (self, tag, attrs): """Check popups for onmouseout and onmouseover. Inline extern javascript sources""" changed = 0 self.js_src = None self.js_output = 0 self.js_popup = 0 for name in ('onmouseover', 'onmouseout'): if attrs.has_key(name) and self.jsPopup(attrs, name): #self._debug("JS: del %s from %s...
b148e442fbaa41c0936bdbd1eac4f2a19641bc8c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/b148e442fbaa41c0936bdbd1eac4f2a19641bc8c/HtmlParser.py
self._debug("JS: jsPopup")
def jsPopup (self, attrs, name): """check if attrs[name] javascript opens a popup window""" #self._debug("JS: jsPopup") val = resolve_html_entities(attrs[name]) if not val: return self.js_env.attachListener(self) try: self.js_env.executeScriptAsFunction(val, 0.0) except jslib.error, msg: pass self.js_env.detachListener...
b148e442fbaa41c0936bdbd1eac4f2a19641bc8c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/b148e442fbaa41c0936bdbd1eac4f2a19641bc8c/HtmlParser.py
self._debug("jsForm %s action %s %s", `name`, `action`, `target`)
def jsForm (self, name, action, target): """when hitting a (named) form, notify the JS engine about that""" if not name: return #self._debug("jsForm %s action %s %s", `name`, `action`, `target`) self.js_env.addForm(name, action, target)
b148e442fbaa41c0936bdbd1eac4f2a19641bc8c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/b148e442fbaa41c0936bdbd1eac4f2a19641bc8c/HtmlParser.py
self._debug("switching back to parse with")
def jsScriptData (self, data, url, ver): """Callback for loading <script src=""> data in the background If downloading is finished, data is None""" assert self.state=='wait' if data is None: if not self.js_script: warn(PARSER, "HtmlParser[%d]: empty JS src %s", self.level, url) else: self.buf.append([STARTTAG, "script"...
b148e442fbaa41c0936bdbd1eac4f2a19641bc8c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/b148e442fbaa41c0936bdbd1eac4f2a19641bc8c/HtmlParser.py
self._debug("JS read %d <= %s", len(data), url)
def jsScriptData (self, data, url, ver): """Callback for loading <script src=""> data in the background If downloading is finished, data is None""" assert self.state=='wait' if data is None: if not self.js_script: warn(PARSER, "HtmlParser[%d]: empty JS src %s", self.level, url) else: self.buf.append([STARTTAG, "script"...
b148e442fbaa41c0936bdbd1eac4f2a19641bc8c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/b148e442fbaa41c0936bdbd1eac4f2a19641bc8c/HtmlParser.py
self._debug("JS: jsScript %s %s", ver, `script`)
def jsScript (self, script, ver, item): """execute given script with javascript version ver""" #self._debug("JS: jsScript %s %s", ver, `script`) assert self.state == 'parse' assert len(self.buf) >= 2 self.js_output = 0 self.js_env.attachListener(self) # start recursive html filter (used by jsProcessData) self.js_html =...
b148e442fbaa41c0936bdbd1eac4f2a19641bc8c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/b148e442fbaa41c0936bdbd1eac4f2a19641bc8c/HtmlParser.py
self._debug("JS: endScript")
def jsEndScript (self, item): #self._debug("JS: endScript") assert len(self.buf) >= 2 if self.js_output: try: self.js_html.feed('') self.js_html.flush() except FilterWait: self.state = 'wait' self.waited = 'True' make_timer(0.1, lambda : self.jsEndScript(item)) return self.js_html._debugbuf() assert not self.js_html.in...
b148e442fbaa41c0936bdbd1eac4f2a19641bc8c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/b148e442fbaa41c0936bdbd1eac4f2a19641bc8c/HtmlParser.py
self._debug("JS: switching back to parse with")
def jsEndScript (self, item): #self._debug("JS: endScript") assert len(self.buf) >= 2 if self.js_output: try: self.js_html.feed('') self.js_html.flush() except FilterWait: self.state = 'wait' self.waited = 'True' make_timer(0.1, lambda : self.jsEndScript(item)) return self.js_html._debugbuf() assert not self.js_html.in...
b148e442fbaa41c0936bdbd1eac4f2a19641bc8c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/b148e442fbaa41c0936bdbd1eac4f2a19641bc8c/HtmlParser.py
if data and self.statuscode != 407 and
if data and self.statuscode != 407 and \
def flush (self): """ Flush data of decoders (if any) and filters and write it to the client. return True if flush was successful. """ assert None == wc.log.debug(wc.LOG_PROXY, "%s HttpServer.flush", self) if not self.statuscode and self.method != 'CONNECT': wc.log.warn(wc.LOG_PROXY, "%s flush without status", self) re...
75f41cf361d7e3c7517d8d880e56290a46c2c12d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/75f41cf361d7e3c7517d8d880e56290a46c2c12d/HttpServer.py
def visit_image(self, node):
class FixedHTMLTranslator (html4css1.HTMLTranslator): def visit_image (self, node):
def visit_image(self, node): """ Like html4css1.visit_image(), but with align="middle" enforcement. """ atts = node.non_default_attributes() # The XHTML standard only allows align="middle" if atts.get('align') == u"center": atts['align'] = u"middle" if atts.has_key('classes'): del atts['classes'] # prevent dupl...
a91ca12aa92c8a8835925bc93e88d41f8ad7b3b4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/a91ca12aa92c8a8835925bc93e88d41f8ad7b3b4/htmlnav.py
Like html4css1.visit_image(), but with align="middle" enforcement.
Like super.visit_image(), but with align="middle" enforcement.
def visit_image(self, node): """ Like html4css1.visit_image(), but with align="middle" enforcement. """ atts = node.non_default_attributes() # The XHTML standard only allows align="middle" if atts.get('align') == u"center": atts['align'] = u"middle" if atts.has_key('classes'): del atts['classes'] # prevent dupl...
a91ca12aa92c8a8835925bc93e88d41f8ad7b3b4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/a91ca12aa92c8a8835925bc93e88d41f8ad7b3b4/htmlnav.py
atts = node.non_default_attributes() if atts.get('align') == u"center": atts['align'] = u"middle" if atts.has_key('classes'): del atts['classes'] atts['src'] = atts['uri'] del atts['uri'] if atts.has_key('scale'): if html4css1.Image and not (atts.has_key('width') and atts.has_key('height')):
atts = {} atts['src'] = node['uri'] if node.has_key('width'): atts['width'] = node['width'] if node.has_key('height'): atts['height'] = node['height'] if node.has_key('scale'): if Image and not (node.has_key('width') and node.has_key('height')):
def visit_image(self, node): """ Like html4css1.visit_image(), but with align="middle" enforcement. """ atts = node.non_default_attributes() # The XHTML standard only allows align="middle" if atts.get('align') == u"center": atts['align'] = u"middle" if atts.has_key('classes'): del atts['classes'] # prevent dupl...
a91ca12aa92c8a8835925bc93e88d41f8ad7b3b4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/a91ca12aa92c8a8835925bc93e88d41f8ad7b3b4/htmlnav.py
im = html4css1.Image.open(str(atts['src']))
im = Image.open(str(atts['src']))
def visit_image(self, node): """ Like html4css1.visit_image(), but with align="middle" enforcement. """ atts = node.non_default_attributes() # The XHTML standard only allows align="middle" if atts.get('align') == u"center": atts['align'] = u"middle" if atts.has_key('classes'): del atts['classes'] # prevent dupl...
a91ca12aa92c8a8835925bc93e88d41f8ad7b3b4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/a91ca12aa92c8a8835925bc93e88d41f8ad7b3b4/htmlnav.py
atts['width'] = im.size[0]
atts['width'] = str(im.size[0])
def visit_image(self, node): """ Like html4css1.visit_image(), but with align="middle" enforcement. """ atts = node.non_default_attributes() # The XHTML standard only allows align="middle" if atts.get('align') == u"center": atts['align'] = u"middle" if atts.has_key('classes'): del atts['classes'] # prevent dupl...
a91ca12aa92c8a8835925bc93e88d41f8ad7b3b4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/a91ca12aa92c8a8835925bc93e88d41f8ad7b3b4/htmlnav.py
atts['height'] = im.size[1]
atts['height'] = str(im.size[1])
def visit_image(self, node): """ Like html4css1.visit_image(), but with align="middle" enforcement. """ atts = node.non_default_attributes() # The XHTML standard only allows align="middle" if atts.get('align') == u"center": atts['align'] = u"middle" if atts.has_key('classes'): del atts['classes'] # prevent dupl...
a91ca12aa92c8a8835925bc93e88d41f8ad7b3b4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/a91ca12aa92c8a8835925bc93e88d41f8ad7b3b4/htmlnav.py
if atts.has_key('width'): atts['width'] = int(round(atts['width'] * (float(atts['scale']) / 100))) if atts.has_key('height'): atts['height'] = int(round(atts['height'] * (float(atts['scale']) / 100))) del atts['scale'] if not atts.has_key('alt'): atts['alt'] = atts['src'] if isinstance(node.parent, nodes.TextElement):
for att_name in 'width', 'height': if atts.has_key(att_name): match = re.match(r'([0-9.]+)(\S*)$', atts[att_name]) assert match atts[att_name] = '%s%s' % ( float(match.group(1)) * (float(node['scale']) / 100), match.group(2)) style = [] for att_name in 'width', 'height': if atts.has_key(att_name): if re.match(r'^[0-9.]...
def visit_image(self, node): """ Like html4css1.visit_image(), but with align="middle" enforcement. """ atts = node.non_default_attributes() # The XHTML standard only allows align="middle" if atts.get('align') == u"center": atts['align'] = u"middle" if atts.has_key('classes'): del atts['classes'] # prevent dupl...
a91ca12aa92c8a8835925bc93e88d41f8ad7b3b4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/a91ca12aa92c8a8835925bc93e88d41f8ad7b3b4/htmlnav.py
else: div_atts = self.image_div_atts(node) self.body.append(self.starttag({}, 'div', '', **div_atts)) self.context.append('</div>\n') self.body.append(self.emptytag(node, 'img', '', **atts)) class HTMLNavTranslator (html4css1.HTMLTranslator):
self.body.append(self.emptytag(node, 'img', suffix, **atts)) class HTMLNavTranslator (FixedHTMLTranslator):
def visit_image(self, node): """ Like html4css1.visit_image(), but with align="middle" enforcement. """ atts = node.non_default_attributes() # The XHTML standard only allows align="middle" if atts.get('align') == u"center": atts['align'] = u"middle" if atts.has_key('classes'): del atts['classes'] # prevent dupl...
a91ca12aa92c8a8835925bc93e88d41f8ad7b3b4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/a91ca12aa92c8a8835925bc93e88d41f8ad7b3b4/htmlnav.py
<![CDATA[
<!--
def get_topframe_bashing (self): return """<script type="text/javascript">
a91ca12aa92c8a8835925bc93e88d41f8ad7b3b4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/a91ca12aa92c8a8835925bc93e88d41f8ad7b3b4/htmlnav.py
]]>
// -->
def get_topframe_bashing (self): return """<script type="text/javascript">
a91ca12aa92c8a8835925bc93e88d41f8ad7b3b4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/a91ca12aa92c8a8835925bc93e88d41f8ad7b3b4/htmlnav.py
p.feed("<hTml>")
def _test(): p = HtmlPrinter() p.feed("<hTml>") p.feed("<a href>") p.feed("<a href=''>") p.feed('<a href="">') p.feed("<a href='a'>") p.feed('<a href="a">') p.feed("<a href=a>") p.feed("<a href='\"'>") p.feed("<a href=\"'\">") p.feed("<a href=' '>") p.feed("<a href=a href=b>") p.feed("<a/>") p.feed("<a href/>") p.feed(...
565cd78c4edea6916e60976b5fa0570f88e50d95 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/565cd78c4edea6916e60976b5fa0570f88e50d95/htmllib.py
p.feed("<a href=''>") p.feed('<a href="">') p.feed("<a href='a'>") p.feed('<a href="a">')
def _test(): p = HtmlPrinter() p.feed("<hTml>") p.feed("<a href>") p.feed("<a href=''>") p.feed('<a href="">') p.feed("<a href='a'>") p.feed('<a href="a">') p.feed("<a href=a>") p.feed("<a href='\"'>") p.feed("<a href=\"'\">") p.feed("<a href=' '>") p.feed("<a href=a href=b>") p.feed("<a/>") p.feed("<a href/>") p.feed(...
565cd78c4edea6916e60976b5fa0570f88e50d95 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/565cd78c4edea6916e60976b5fa0570f88e50d95/htmllib.py
p.feed("<a href='\"'>") p.feed("<a href=\"'\">") p.feed("<a href=' '>") p.feed("<a href=a href=b>") p.feed("<a/>") p.feed("<a href/>") p.feed("<a href=a />") p.feed("</a>") p.feed("<?bla foo?>") p.feed("<?bla?>") p.feed("<!-- - comment -->") p.feed("<!---->") p.feed("<!DOCTYPE \"vla foo>")
def _test(): p = HtmlPrinter() p.feed("<hTml>") p.feed("<a href>") p.feed("<a href=''>") p.feed('<a href="">') p.feed("<a href='a'>") p.feed('<a href="a">') p.feed("<a href=a>") p.feed("<a href='\"'>") p.feed("<a href=\"'\">") p.feed("<a href=' '>") p.feed("<a href=a href=b>") p.feed("<a/>") p.feed("<a href/>") p.feed(...
565cd78c4edea6916e60976b5fa0570f88e50d95 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/565cd78c4edea6916e60976b5fa0570f88e50d95/htmllib.py
p.feed(""" """)
p.feed("")
def _broken (): p = HtmlPrinter() p.feed(""" """) p.flush()
565cd78c4edea6916e60976b5fa0570f88e50d95 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/565cd78c4edea6916e60976b5fa0570f88e50d95/htmllib.py
_broken()
_test()
def _broken (): p = HtmlPrinter() p.feed(""" """) p.flush()
565cd78c4edea6916e60976b5fa0570f88e50d95 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/565cd78c4edea6916e60976b5fa0570f88e50d95/htmllib.py
for c in '<!-- -->':
for c in '<a/>':
def _broken (): p = HtmlPrinter() for c in '<!-- -->': p.feed(c) p.flush()
64df81f24d6581935cd1910a3222681bcace5239 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/64df81f24d6581935cd1910a3222681bcace5239/htmllib.py
debug(BRING_IT_ON, "removing header", `h`)
def remove_headers (headers, to_remove): """utility function to remove entries from RFC822 headers""" for h in to_remove: if headers.has_key(h): debug(BRING_IT_ON, "removing header", `h`) del headers[h]
b27269ed91b8e4886956108de4904f792a4ff62a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/b27269ed91b8e4886956108de4904f792a4ff62a/__init__.py
HtmlParser.feed(self, data)
self.parser.feed(data)
def feed (self, data): """feed some data to the parser""" if self.state=='parse': # look if we must replay something if self.waited: self.waited = 0 waitbuf, self.waitbuf = self.waitbuf, [] self.replay(waitbuf) if self.state!='parse': return data = self.inbuf.getvalue() self.inbuf.close() self.inbuf = StringIO() if dat...
d7fc78754f8d18fb4cb238f57002ba5d078f0dc8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/d7fc78754f8d18fb4cb238f57002ba5d078f0dc8/Rewriter.py
HtmlParser.flush(self)
self.parser.flush()
def flush (self): #self._debug(HURT_ME_PLENTY, "flush") # flushing in wait state raises a filter exception if self.state=='wait': raise FilterException("HtmlFilter[%d]: still waiting for data"%self.level) HtmlParser.flush(self)
d7fc78754f8d18fb4cb238f57002ba5d078f0dc8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/d7fc78754f8d18fb4cb238f57002ba5d078f0dc8/Rewriter.py
wc.set_debuglevel(wc.HURT_ME_PLENTY)
wc.set_debuglevel(wc.NIGHTMARE)
def _main(): fname = sys.argv[1] if fname=="-": f = sys.stdin else: f = file(fname) import wc, time wc.config = wc.Configuration() # set debug level wc.set_debuglevel(wc.HURT_ME_PLENTY) wc.config['filters'] = ['Replacer', 'Rewriter', 'BinaryCharFilter'] wc.config.init_filter_modules() from wc.proxy import proxy_poll, r...
595daecc5983d5fcc29db04a559a669a213d19b9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/595daecc5983d5fcc29db04a559a669a213d19b9/filterfile.py
filtered = wc.filter.applyfilter(wc.filter.FILTER_RESPONSE_MODIFY, data, 'filter', attrs)
filtered += wc.filter.applyfilter(wc.filter.FILTER_RESPONSE_MODIFY, data, 'filter', attrs)
def _main(): fname = sys.argv[1] if fname=="-": f = sys.stdin else: f = file(fname) import wc, time wc.config = wc.Configuration() # set debug level wc.set_debuglevel(wc.HURT_ME_PLENTY) wc.config['filters'] = ['Replacer', 'Rewriter', 'BinaryCharFilter'] wc.config.init_filter_modules() from wc.proxy import proxy_poll, r...
595daecc5983d5fcc29db04a559a669a213d19b9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/595daecc5983d5fcc29db04a559a669a213d19b9/filterfile.py
filtered = wc.filter.applyfilter(wc.filter.FILTER_RESPONSE_MODIFY,
filtered += wc.filter.applyfilter(wc.filter.FILTER_RESPONSE_MODIFY,
def _main(): fname = sys.argv[1] if fname=="-": f = sys.stdin else: f = file(fname) import wc, time wc.config = wc.Configuration() # set debug level wc.set_debuglevel(wc.HURT_ME_PLENTY) wc.config['filters'] = ['Replacer', 'Rewriter', 'BinaryCharFilter'] wc.config.init_filter_modules() from wc.proxy import proxy_poll, r...
595daecc5983d5fcc29db04a559a669a213d19b9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/595daecc5983d5fcc29db04a559a669a213d19b9/filterfile.py
print "Test: finish: exception:", msg
print >>sys.stderr, "Test: finish: exception:", msg
def _main(): fname = sys.argv[1] if fname=="-": f = sys.stdin else: f = file(fname) import wc, time wc.config = wc.Configuration() # set debug level wc.set_debuglevel(wc.HURT_ME_PLENTY) wc.config['filters'] = ['Replacer', 'Rewriter', 'BinaryCharFilter'] wc.config.init_filter_modules() from wc.proxy import proxy_poll, r...
595daecc5983d5fcc29db04a559a669a213d19b9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/595daecc5983d5fcc29db04a559a669a213d19b9/filterfile.py
if server.headers.has_key('Transfer-Encoding'): to_remove.add('Transfer-Encoding') tencs = server.headers['Transfer-Encoding'].lower() for tenc in tencs.split(","): tenc = tenc.strip() if ";" in tenc: tenc = tenc.split(";", 1)[0] if not tenc or tenc == 'identity': continue if tenc == 'chunked': server.decoders.append(U...
def server_set_encoding_headers (server, filename=None): """ Set encoding headers. """ rewrite = server.is_rewrite() bytes_remaining = get_content_length(server.headers) to_remove = sets.Set() # remove content length if rewrite: to_remove.add('Content-Length') # add decoders if server.headers.has_key('Transfer-Encoding...
1d0b4dde3d21f983a9244c939ccb80fd5778999a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/1d0b4dde3d21f983a9244c939ccb80fd5778999a/Headers.py
if server.headers.has_key('Transfer-Encoding'): tenc = server.headers['Transfer-Encoding'] if tenc != 'chunked': wc.log.warn(wc.LOG_PROXY, "unknown transfer encoding %r, assuming chunked encoding", tenc) server.decoders.append(UnchunkStream.UnchunkStream(server)) server.encoders.append(ChunkStream.ChunkStream(server)...
def server_set_encoding_headers (server, filename=None): """ Set encoding headers. """ rewrite = server.is_rewrite() bytes_remaining = get_content_length(server.headers) to_remove = sets.Set() # remove content length if rewrite: to_remove.add('Content-Length') # add decoders if server.headers.has_key('Transfer-Encoding...
1d0b4dde3d21f983a9244c939ccb80fd5778999a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/1d0b4dde3d21f983a9244c939ccb80fd5778999a/Headers.py
if not server.headers.has_key('Content-Length'): server.headers['Connection'] = 'close\r'
def server_set_encoding_headers (server, filename=None): """ Set encoding headers. """ rewrite = server.is_rewrite() bytes_remaining = get_content_length(server.headers) to_remove = sets.Set() # remove content length if rewrite: to_remove.add('Content-Length') # add decoders if server.headers.has_key('Transfer-Encoding...
1d0b4dde3d21f983a9244c939ccb80fd5778999a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/1d0b4dde3d21f983a9244c939ccb80fd5778999a/Headers.py
encoding = server.headers.get('Content-Encoding', '').lower() if encoding in ('gzip', 'x-gzip', 'deflate') and \ (filename is None or not filename.endswith(".gz")): if encoding == 'deflate': server.decoders.append(DeflateStream.DeflateStream()) else: server.decoders.append(GunzipStream.GunzipStream()) to_remove = ['C...
if server.headers.has_key('Content-Encoding'): to_remove.add('Content-Encoding') cencs = server.headers['Content-Encoding'].lower() for cenc in cencs.split(","): cenc = cenc.strip() if ";" in cenc: cenc = cenc.split(";", 1)[0] if not cenc or cenc == 'identity': continue if filename is not None and \ (filename.endswith(...
def server_set_encoding_headers (server, filename=None): """ Set encoding headers. """ rewrite = server.is_rewrite() bytes_remaining = get_content_length(server.headers) to_remove = sets.Set() # remove content length if rewrite: to_remove.add('Content-Length') # add decoders if server.headers.has_key('Transfer-Encoding...
1d0b4dde3d21f983a9244c939ccb80fd5778999a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/1d0b4dde3d21f983a9244c939ccb80fd5778999a/Headers.py
to_remove.append('Cache-Control') remove_headers(server.headers, to_remove)
to_remove.add('Cache-Control')
def server_set_encoding_headers (server, filename=None): """ Set encoding headers. """ rewrite = server.is_rewrite() bytes_remaining = get_content_length(server.headers) to_remove = sets.Set() # remove content length if rewrite: to_remove.add('Content-Length') # add decoders if server.headers.has_key('Transfer-Encoding...
1d0b4dde3d21f983a9244c939ccb80fd5778999a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/1d0b4dde3d21f983a9244c939ccb80fd5778999a/Headers.py
elif encoding and encoding!='identity': wc.log.warn(wc.LOG_PROXY, _("unsupported encoding: %r"), encoding) if not server.headers.has_key('Content-Length'): server.headers['Connection'] = 'close\r'
remove_headers(server.headers, to_remove)
def server_set_encoding_headers (server, filename=None): """ Set encoding headers. """ rewrite = server.is_rewrite() bytes_remaining = get_content_length(server.headers) to_remove = sets.Set() # remove content length if rewrite: to_remove.add('Content-Length') # add decoders if server.headers.has_key('Transfer-Encoding...
1d0b4dde3d21f983a9244c939ccb80fd5778999a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/1d0b4dde3d21f983a9244c939ccb80fd5778999a/Headers.py
hostset.add(expand_ip(host))
hostset.add(expand_ip(host)[0])
def hosts2map (hosts): """return a set of named hosts, and a list of subnets (host/netmask adresses). Only IPv4 host/netmasks are supported. """ hostset = Set() nets = [] for host in hosts: if _host_bitmask_re.match(host): host, mask = host.split("/") mask = int(mask) if not is_valid_bitmask(mask): error(PROXY, "bitmas...
e5f55f265db01ddd479e1a95dc970fd6b78a7549 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/e5f55f265db01ddd479e1a95dc970fd6b78a7549/ip.py
ips = resolve_host(host) for i in ips: hostset.add(i)
hostset |= resolve_host(host)
def hosts2map (hosts): """return a set of named hosts, and a list of subnets (host/netmask adresses). Only IPv4 host/netmasks are supported. """ hostset = Set() nets = [] for host in hosts: if _host_bitmask_re.match(host): host, mask = host.split("/") mask = int(mask) if not is_valid_bitmask(mask): error(PROXY, "bitmas...
e5f55f265db01ddd479e1a95dc970fd6b78a7549 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/e5f55f265db01ddd479e1a95dc970fd6b78a7549/ip.py
item = form[key] if isinstance(item, list): item = item[0] elif hasattr(item, "value"): item = item.value return item.decode(charset)
return get_item_value(form[key])
def getval (form, key): """return a formfield value""" if not form.has_key(key): return u'' item = form[key] if isinstance(item, list): item = item[0] elif hasattr(item, "value"): item = item.value return item.decode(charset)
ebb3f0f8f26d57ebcf5818dbfd680ba9192a5d5f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/ebb3f0f8f26d57ebcf5818dbfd680ba9192a5d5f/__init__.py
item = form[key] if isinstance(item, list): l = [x.value for x in item] elif hasattr(item, "value"): l = [item.value] else: l = [item] return [ x.decode(charset) for x in l ]
return get_item_list(form[key]) def get_prefix_vals (form, prefix): """return a list of (key, value) pairs where ``prefix+key'' is a valid form field""" res = [] for key, item in form.items(): if key.startswith(prefix): res.append(key[len(prefix):], get_item_value(item)) return res
def getlist (form, key): """return a list of formfield values""" if not form.has_key(key): return [] item = form[key] if isinstance(item, list): l = [x.value for x in item] elif hasattr(item, "value"): l = [item.value] else: l = [item] return [ x.decode(charset) for x in l ]
ebb3f0f8f26d57ebcf5818dbfd680ba9192a5d5f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/ebb3f0f8f26d57ebcf5818dbfd680ba9192a5d5f/__init__.py
if ct != self.mime:
if ct is None:
def check_headers (self): """add missing content-type and/or encoding headers""" # 304 Not Modified does not send any type or encoding info, # because this info was cached if self.statuscode == '304': return # check content-type against our own guess i = self.document.find('?') if i>0: document = self.document[:i] else...
cfd97cb940d0a998442a77b2135d577375a80494 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/cfd97cb940d0a998442a77b2135d577375a80494/HttpServer.py
self.js_filter = opts['javascript'] and jslib
self.javascript = opts['javascript'] and jslib
def __init__ (self, opts): self.js_filter = opts['javascript'] and jslib self.js_html = None self.js_src = False self.js_script = '' if self.js_filter: self.js_env = jslib.new_jsenv() self.js_output = 0 self.js_popup = 0
9d308cf36c9925fe55e611168b12175184ce8c08 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/9d308cf36c9925fe55e611168b12175184ce8c08/HtmlParser.py
if self.js_filter:
if self.javascript:
def __init__ (self, opts): self.js_filter = opts['javascript'] and jslib self.js_html = None self.js_src = False self.js_script = '' if self.js_filter: self.js_env = jslib.new_jsenv() self.js_output = 0 self.js_popup = 0
9d308cf36c9925fe55e611168b12175184ce8c08 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/9d308cf36c9925fe55e611168b12175184ce8c08/HtmlParser.py
error(FILTER, "waited too long for %s"%self.state[1]) self.js_client.finish() self.js_html = None
def flush (self): self._debug("flush") if self.waited > 100: # waited too long; stop js background downloader and # switch back to parse error(FILTER, "waited too long for %s"%self.state[1]) if self.js_env.hasListener(self): self.js_env.detachListener(self) self.js_html = None self.state = ('parse',) self.feed("") # wi...
9d308cf36c9925fe55e611168b12175184ce8c08 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/9d308cf36c9925fe55e611168b12175184ce8c08/HtmlParser.py
error(FILTER, "waited too long for %s"%self.state[1]) if self.js_env.hasListener(self): self.js_env.detachListener(self) self.js_html = None
def flush (self): self._debug("flush") if self.waited > 100: # waited too long; stop js background downloader and # switch back to parse error(FILTER, "waited too long for %s"%self.state[1]) if self.js_env.hasListener(self): self.js_env.detachListener(self) self.js_html = None self.state = ('parse',) self.feed("") # wi...
9d308cf36c9925fe55e611168b12175184ce8c08 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/9d308cf36c9925fe55e611168b12175184ce8c08/HtmlParser.py
self.feed("")
self.feed("")
def flush (self): self._debug("flush") if self.waited > 100: # waited too long; stop js background downloader and # switch back to parse error(FILTER, "waited too long for %s"%self.state[1]) if self.js_env.hasListener(self): self.js_env.detachListener(self) self.js_html = None self.state = ('parse',) self.feed("") # wi...
9d308cf36c9925fe55e611168b12175184ce8c08 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/9d308cf36c9925fe55e611168b12175184ce8c08/HtmlParser.py
elif self.js_filter:
elif self.javascript:
def startElement (self, tag, attrs): """We get a new start tag. New rules could be appended to the pending rules. No rules can be removed from the list.""" # default data self._debug("startElement %s", `tag`) tag = check_spelling(tag, self.url) item = [STARTTAG, tag, attrs] if self.state[0]=='wait': self.waitbuf.append...
9d308cf36c9925fe55e611168b12175184ce8c08 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/9d308cf36c9925fe55e611168b12175184ce8c08/HtmlParser.py
if not self.rulestack and not self.js_filter:
if not self.rulestack and not self.javascript:
def startElement (self, tag, attrs): """We get a new start tag. New rules could be appended to the pending rules. No rules can be removed from the list.""" # default data self._debug("startElement %s", `tag`) tag = check_spelling(tag, self.url) item = [STARTTAG, tag, attrs] if self.state[0]=='wait': self.waitbuf.append...
9d308cf36c9925fe55e611168b12175184ce8c08 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/9d308cf36c9925fe55e611168b12175184ce8c08/HtmlParser.py
if self.js_filter and tag=='script':
if self.javascript and tag=='script':
def endElement (self, tag): """We know the following: if a rule matches, it must be the one on the top of the stack. So we look only at the top rule.
9d308cf36c9925fe55e611168b12175184ce8c08 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/9d308cf36c9925fe55e611168b12175184ce8c08/HtmlParser.py
client = HttpProxyClient(self.jsScriptData, (url, ver)) ClientServerMatchmaker(client, "GET %s HTTP/1.1" % url, WcMessage(StringIO('')), '',
self.js_client = HttpProxyClient(self.jsScriptData, (url, ver)) ClientServerMatchmaker(self.js_client, "GET %s HTTP/1.1" % url, WcMessage(StringIO('')), '',
def jsScriptSrc (self, url, language): """Start a background download for <script src=""> tags""" assert self.state[0]=='parse', "non-parse state %s" % str(self.state) ver = get_js_ver(language) if self.base_url: url = urlparse.urljoin(self.base_url, url) else: url = urlparse.urljoin(self.url, url) url = norm_url(url) ...
9d308cf36c9925fe55e611168b12175184ce8c08 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/9d308cf36c9925fe55e611168b12175184ce8c08/HtmlParser.py
comments=self.comments, javascript=self.js_filter, level=self.level+1)
comments=self.comments, javascript=self.javascript, level=self.level+1)
def jsScript (self, script, ver, item): """execute given script with javascript version ver""" self._debug("JS: jsScript %s %s", ver, `script`) assert self.state[0]=='parse', "non-parse state %s" % str(self.state) assert len(self.buf) >= 2, "too small buffer %s" % str(self.buf) self.js_output = 0 self.js_env.attachList...
9d308cf36c9925fe55e611168b12175184ce8c08 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/9d308cf36c9925fe55e611168b12175184ce8c08/HtmlParser.py
from urllib import splittype, splithost, splitport
from urllib import splittype, splithost, splitnport
def fileno(self): return self.socket.fileno()
8b9d971b788b3e4589331da9aac5312e6ac40978 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/8b9d971b788b3e4589331da9aac5312e6ac40978/__init__.py
if not host: hostname = "localhost" port = config['port'] else: hostname, port = splitport(host) if port is None: port = 80 else: port = int(port) return scheme, hostname.lower(), port, document
port = 80 if host: host = host.lower() host, port = splitnport(host, 80) return scheme, host, port, document
def spliturl (url): """split url in a tuple (scheme, hostname, port, document) where hostname is always lowercased""" # XXX this relies on scheme==http! scheme, netloc = splittype(url) host, document = splithost(netloc) if not host: hostname = "localhost" port = config['port'] else: hostname, port = splitport(host) if ...
8b9d971b788b3e4589331da9aac5312e6ac40978 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/8b9d971b788b3e4589331da9aac5312e6ac40978/__init__.py
info.append("Rule removed")
info.append(i18n._("Rule removed"))
def _form_removerule (rule): curfolder.rules.remove(rule) global currule currule = None info.append("Rule removed")
9ad2312d756ee18c5d8cc9bb1f58ad01a1c25b45 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/9ad2312d756ee18c5d8cc9bb1f58ad01a1c25b45/filterconfig_html.py
info.append("Attribute added")
info.append(i18n._("Rewrite attribute added"))
def _form_rewrite_addattr (form): name = getval(form, "attrname").strip() if not name: error.append(i18n._("Empty attribute name")) return value = getval(form, "attrval") currule.attrs[name] = value info.append("Attribute added")
9ad2312d756ee18c5d8cc9bb1f58ad01a1c25b45 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/9ad2312d756ee18c5d8cc9bb1f58ad01a1c25b45/filterconfig_html.py
info.append("Attributes removed")
info.append(i18n._("Rewrite attributes removed"))
def _form_rewrite_removeattrs (form): toremove = getlist(form, 'delattr') if toremove: for attr in toremove: del currule.attrs[attr] info.append("Attributes removed")
9ad2312d756ee18c5d8cc9bb1f58ad01a1c25b45 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/9ad2312d756ee18c5d8cc9bb1f58ad01a1c25b45/filterconfig_html.py
error.append("Empty rule title")
error.append(i18n._("Empty rule title"))
def _form_rule_titledesc (form): title = getval(form, 'rule_title') if not title: error.append("Empty rule title") return if title!=currule.title: currule.title = title info.append("Rule title changed") desc = getval(form, 'rule_description') if desc!=currule.desc: currule.desc = desc info.append("Rule description chan...
9ad2312d756ee18c5d8cc9bb1f58ad01a1c25b45 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/9ad2312d756ee18c5d8cc9bb1f58ad01a1c25b45/filterconfig_html.py
info.append("Rule title changed")
info.append(i18n._("Rule title changed"))
def _form_rule_titledesc (form): title = getval(form, 'rule_title') if not title: error.append("Empty rule title") return if title!=currule.title: currule.title = title info.append("Rule title changed") desc = getval(form, 'rule_description') if desc!=currule.desc: currule.desc = desc info.append("Rule description chan...
9ad2312d756ee18c5d8cc9bb1f58ad01a1c25b45 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/9ad2312d756ee18c5d8cc9bb1f58ad01a1c25b45/filterconfig_html.py
info.append("Rule description changed")
info.append(i18n._("Rule description changed"))
def _form_rule_titledesc (form): title = getval(form, 'rule_title') if not title: error.append("Empty rule title") return if title!=currule.title: currule.title = title info.append("Rule title changed") desc = getval(form, 'rule_description') if desc!=currule.desc: currule.desc = desc info.append("Rule description chan...
9ad2312d756ee18c5d8cc9bb1f58ad01a1c25b45 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/9ad2312d756ee18c5d8cc9bb1f58ad01a1c25b45/filterconfig_html.py
info.append("Rule match url changed")
info.append(i18n._("Rule match url changed"))
def _form_rule_matchurl (form): matchurl = getval(form, 'rule_matchurl').strip() if matchurl!=currule.matchurl: currule.matchurl = matchurl info.append("Rule match url changed") dontmatchurl = getval(form, 'rule_dontmatchurl').strip() if dontmatchurl!=currule.dontmatchurl: currule.dontmatchurl = dontmatchurl info.appen...
9ad2312d756ee18c5d8cc9bb1f58ad01a1c25b45 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/9ad2312d756ee18c5d8cc9bb1f58ad01a1c25b45/filterconfig_html.py
info.append("Rule dontmatch url changed")
info.append(i18n._("Rule dontmatch url changed"))
def _form_rule_matchurl (form): matchurl = getval(form, 'rule_matchurl').strip() if matchurl!=currule.matchurl: currule.matchurl = matchurl info.append("Rule match url changed") dontmatchurl = getval(form, 'rule_dontmatchurl').strip() if dontmatchurl!=currule.dontmatchurl: currule.dontmatchurl = dontmatchurl info.appen...
9ad2312d756ee18c5d8cc9bb1f58ad01a1c25b45 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/9ad2312d756ee18c5d8cc9bb1f58ad01a1c25b45/filterconfig_html.py
info.append("Rule url scheme changed")
info.append(i18n._("Rule url scheme changed"))
def _form_rule_urlparts (form): scheme = getval(form, 'rule_urlscheme').strip() if scheme!=currule.scheme: currule.scheme = scheme info.append("Rule url scheme changed") host = getval(form, 'rule_urlhost').strip() if host!=currule.host: currule.host = host info.append("Rule url host changed") port = getval(form, 'rule_...
9ad2312d756ee18c5d8cc9bb1f58ad01a1c25b45 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/9ad2312d756ee18c5d8cc9bb1f58ad01a1c25b45/filterconfig_html.py
info.append("Rule url host changed")
info.append(i18n._("Rule url host changed"))
def _form_rule_urlparts (form): scheme = getval(form, 'rule_urlscheme').strip() if scheme!=currule.scheme: currule.scheme = scheme info.append("Rule url scheme changed") host = getval(form, 'rule_urlhost').strip() if host!=currule.host: currule.host = host info.append("Rule url host changed") port = getval(form, 'rule_...
9ad2312d756ee18c5d8cc9bb1f58ad01a1c25b45 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/9ad2312d756ee18c5d8cc9bb1f58ad01a1c25b45/filterconfig_html.py
info.append("Rule url port changed")
info.append(i18n._("Rule url port changed"))
def _form_rule_urlparts (form): scheme = getval(form, 'rule_urlscheme').strip() if scheme!=currule.scheme: currule.scheme = scheme info.append("Rule url scheme changed") host = getval(form, 'rule_urlhost').strip() if host!=currule.host: currule.host = host info.append("Rule url host changed") port = getval(form, 'rule_...
9ad2312d756ee18c5d8cc9bb1f58ad01a1c25b45 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/9ad2312d756ee18c5d8cc9bb1f58ad01a1c25b45/filterconfig_html.py
info.append("Rule url path changed")
info.append(i18n._("Rule url path changed"))
def _form_rule_urlparts (form): scheme = getval(form, 'rule_urlscheme').strip() if scheme!=currule.scheme: currule.scheme = scheme info.append("Rule url scheme changed") host = getval(form, 'rule_urlhost').strip() if host!=currule.host: currule.host = host info.append("Rule url host changed") port = getval(form, 'rule_...
9ad2312d756ee18c5d8cc9bb1f58ad01a1c25b45 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/9ad2312d756ee18c5d8cc9bb1f58ad01a1c25b45/filterconfig_html.py
info.append("Rule url parameters changed")
info.append(i18n._("Rule url parameters changed"))
def _form_rule_urlparts (form): scheme = getval(form, 'rule_urlscheme').strip() if scheme!=currule.scheme: currule.scheme = scheme info.append("Rule url scheme changed") host = getval(form, 'rule_urlhost').strip() if host!=currule.host: currule.host = host info.append("Rule url host changed") port = getval(form, 'rule_...
9ad2312d756ee18c5d8cc9bb1f58ad01a1c25b45 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3948/9ad2312d756ee18c5d8cc9bb1f58ad01a1c25b45/filterconfig_html.py