bugged stringlengths 4 228k | fixed stringlengths 0 96.3M | __index_level_0__ int64 0 481k |
|---|---|---|
def testFilter (self): self.filt("""<script src="#ivwbox.de"></script>""", "") | def testFilter (self): self.filt("""<script src="#ivwbox.de"></script>""", "") | 16,200 |
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.... | 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.... | 16,201 |
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.... | 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.... | 16,202 |
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}... | def _reset_ratings (): 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} rating_modified... | 16,203 |
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}... | def _reset_ratings (): ratings.clear() for category, catdata in service['categories'].items(): if catdata['rvalues']: ratings[category] = catdata['rvalues'][0] else: ratings[category] = "" values[category] = {} for value in catdata['rvalues']: values[category][value] = False rating_modified.clear() | 16,204 |
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" ") | 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" ") | 16,205 |
def _form_reset (): info.clear() error.clear() _reset_ratings() global url, generic, curindex url = u"" generic = False curindex = 0 | def _form_reset (): for key in info.keys(): info[key] = False for key in error.keys(): error[key] = False _reset_ratings() global url, generic, curindex url = u"" generic = False curindex = 0 | 16,206 |
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 | def clean (script, jscomments=True): """ Clean script from comments and HTML. """ script = escape_js(remove_html_comments(script, jscomments=jscomments)) return u"\n<!--\n%s\n//-->\n" % script | 16,207 |
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 | 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 | 16,208 |
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 ... | 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 ... | 16,209 |
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.... | def remove_html_comments (script, jscomments=True): """ 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("//") ... | 16,210 |
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.... | def remove_html_comments (script): """ Remove leading and trailing HTML comments from the script text. """ 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) mo = _start_js_comment(script) if mo: s... | 16,211 |
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... | 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... | 16,212 |
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) | defself._debug("JS document.write %s", `data`) jsProcessDataself._debug("JS document.write %s", `data`) (self,self._debug("JS document.write %s", `data`) data):self._debug("JS document.write %s", `data`) """processself._debug("JS document.write %s", `data`) dataself._debug("JS document.write %s", `data`) producedself._... | 16,213 |
def jsProcessPopup (self): """process javascript popup""" #self._debug("JS: popup") self.js_popup += 1 | defself._debug("JS: popup") jsProcessPopupself._debug("JS: popup") (self):self._debug("JS: popup") """processself._debug("JS: popup") javascriptself._debug("JS: popup") popup"""self._debug("JS: popup") #self._debug("JS:self._debug("JS: popup") popup")self._debug("JS: popup") self.js_popupself._debug("JS: popup") +=self... | 16,214 |
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... | defself._debug("buf_append_data") buf_append_dataself._debug("buf_append_data") (self,self._debug("buf_append_data") data):self._debug("buf_append_data") """weself._debug("buf_append_data") haveself._debug("buf_append_data") toself._debug("buf_append_data") makeself._debug("buf_append_data") sureself._debug("buf_append... | 16,215 |
def flushbuf (self): """clear and return the output buffer""" #self._debug("flushbuf") data = self.outbuf.getvalue() self.outbuf.close() self.outbuf = StringIO() return data | defself._debug("flushbuf") flushbufself._debug("flushbuf") (self):self._debug("flushbuf") """clearself._debug("flushbuf") andself._debug("flushbuf") returnself._debug("flushbuf") theself._debug("flushbuf") outputself._debug("flushbuf") buffer"""self._debug("flushbuf") #self._debug("flushbuf")self._debug("flushbuf") dat... | 16,216 |
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()`) | 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()`) | 16,217 |
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() ... | defself._debug("feed %s", `data`) feedself._debug("feed %s", `data`) (self,self._debug("feed %s", `data`) data):self._debug("feed %s", `data`) """feedself._debug("feed %s", `data`) someself._debug("feed %s", `data`) dataself._debug("feed %s", `data`) toself._debug("feed %s", `data`) theself._debug("feed %s", `data`) pa... | 16,218 |
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() ... | defself._debug("feed") feedself._debug("feed") (self,self._debug("feed") data):self._debug("feed") """feedself._debug("feed") someself._debug("feed") dataself._debug("feed") toself._debug("feed") theself._debug("feed") parser"""self._debug("feed") ifself._debug("feed") self.state=='parse':self._debug("feed") #self._deb... | 16,219 |
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() ... | defself._debug("wait") feedself._debug("wait") (self,self._debug("wait") data):self._debug("wait") """feedself._debug("wait") someself._debug("wait") dataself._debug("wait") toself._debug("wait") theself._debug("wait") parser"""self._debug("wait") ifself._debug("wait") self.state=='parse':self._debug("wait") #self._deb... | 16,220 |
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() | defself._debug("flush") flushself._debug("flush") (self):self._debug("flush") #self._debug("flush")self._debug("flush") #self._debug("flush") flushingself._debug("flush") inself._debug("flush") waitself._debug("flush") stateself._debug("flush") raisesself._debug("flush") aself._debug("flush") filterself._debug("flush")... | 16,221 |
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... | defself._debug("replay %s", `waitbuf`) replayself._debug("replay %s", `waitbuf`) (self,self._debug("replay %s", `waitbuf`) waitbuf):self._debug("replay %s", `waitbuf`) """callself._debug("replay %s", `waitbuf`) theself._debug("replay %s", `waitbuf`) handlerself._debug("replay %s", `waitbuf`) functionsself._debug("repla... | 16,222 |
def cdata (self, data): """character data""" #self._debug("cdata %s", `data`) return self._data(data) | defself._debug("cdata %s", `data`) cdataself._debug("cdata %s", `data`) (self,self._debug("cdata %s", `data`) data):self._debug("cdata %s", `data`) """characterself._debug("cdata %s", `data`) data"""self._debug("cdata %s", `data`) #self._debug("cdataself._debug("cdata %s", `data`) %s",self._debug("cdata %s", `data`) `d... | 16,223 |
def characters (self, data): """characters""" #self._debug("characters %s", `data`) return self._data(data) | defself._debug("characters %s", `data`) charactersself._debug("characters %s", `data`) (self,self._debug("characters %s", `data`) data):self._debug("characters %s", `data`) """characters"""self._debug("characters %s", `data`) #self._debug("charactersself._debug("characters %s", `data`) %s",self._debug("characters %s", ... | 16,224 |
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) | defself._debug("comment %s", `data`) commentself._debug("comment %s", `data`) (self,self._debug("comment %s", `data`) data):self._debug("comment %s", `data`) """aself._debug("comment %s", `data`) comment;self._debug("comment %s", `data`) acceptself._debug("comment %s", `data`) onlyself._debug("comment %s", `data`) non-... | 16,225 |
def doctype (self, data): #self._debug("doctype %s", `data`) return self._data("<!DOCTYPE%s>"%data) | defself._debug("doctype %s", `data`) doctypeself._debug("doctype %s", `data`) (self,self._debug("doctype %s", `data`) data):self._debug("doctype %s", `data`) #self._debug("doctypeself._debug("doctype %s", `data`) %s",self._debug("doctype %s", `data`) `data`)self._debug("doctype %s", `data`) returnself._debug("doctype %... | 16,226 |
def pi (self, data): #self._debug("pi %s", `data`) return self._data("<?%s?>"%data) | defself._debug("pi %s", `data`) piself._debug("pi %s", `data`) (self,self._debug("pi %s", `data`) data):self._debug("pi %s", `data`) #self._debug("piself._debug("pi %s", `data`) %s",self._debug("pi %s", `data`) `data`)self._debug("pi %s", `data`) returnself._debug("pi %s", `data`) self._data("<?%s?>"%data) | 16,227 |
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... | defself._debug("startElement %s", `tag`) startElementself._debug("startElement %s", `tag`) (self,self._debug("startElement %s", `tag`) tag,self._debug("startElement %s", `tag`) attrs):self._debug("startElement %s", `tag`) """Weself._debug("startElement %s", `tag`) getself._debug("startElement %s", `tag`) aself._debug("... | 16,228 |
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... | defself._debug("matched rule %s on tag %s", `rule.title`, `tag`) startElementself._debug("matched rule %s on tag %s", `rule.title`, `tag`) (self,self._debug("matched rule %s on tag %s", `rule.title`, `tag`) tag,self._debug("matched rule %s on tag %s", `rule.title`, `tag`) attrs):self._debug("matched rule %s on tag %s",... | 16,229 |
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... | defself._debug("put on buffer") startElementself._debug("put on buffer") (self,self._debug("put on buffer") tag,self._debug("put on buffer") attrs):self._debug("put on buffer") """Weself._debug("put on buffer") getself._debug("put on buffer") aself._debug("put on buffer") newself._debug("put on buffer") startself._debu... | 16,230 |
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. | defself._debug("endElement %s", `tag`) endElementself._debug("endElement %s", `tag`) (self,self._debug("endElement %s", `tag`) tag):self._debug("endElement %s", `tag`) """Weself._debug("endElement %s", `tag`) knowself._debug("endElement %s", `tag`) theself._debug("endElement %s", `tag`) following:self._debug("endElemen... | 16,231 |
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... | defself._debug("JS: del %s from %s", `name`, `tag`) jsStartElementself._debug("JS: del %s from %s", `name`, `tag`) (self,self._debug("JS: del %s from %s", `name`, `tag`) tag,self._debug("JS: del %s from %s", `name`, `tag`) attrs):self._debug("JS: del %s from %s", `name`, `tag`) """Checkself._debug("JS: del %s from %s",... | 16,232 |
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... | defself._debug("JS: jsPopup") jsPopupself._debug("JS: jsPopup") (self,self._debug("JS: jsPopup") attrs,self._debug("JS: jsPopup") name):self._debug("JS: jsPopup") """checkself._debug("JS: jsPopup") ifself._debug("JS: jsPopup") attrs[name]self._debug("JS: jsPopup") javascriptself._debug("JS: jsPopup") opensself._debug("... | 16,233 |
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) | defself._debug("jsForm %s action %s %s", `name`, `action`, `target`) jsFormself._debug("jsForm %s action %s %s", `name`, `action`, `target`) (self,self._debug("jsForm %s action %s %s", `name`, `action`, `target`) name,self._debug("jsForm %s action %s %s", `name`, `action`, `target`) action,self._debug("jsForm %s action... | 16,234 |
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"... | defself._debug("switching back to parse with") jsScriptDataself._debug("switching back to parse with") (self,self._debug("switching back to parse with") data,self._debug("switching back to parse with") url,self._debug("switching back to parse with") ver):self._debug("switching back to parse with") """Callbackself._debu... | 16,235 |
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"... | defself._debug("JS read %d <= %s", len(data), url) jsScriptDataself._debug("JS read %d <= %s", len(data), url) (self,self._debug("JS read %d <= %s", len(data), url) data,self._debug("JS read %d <= %s", len(data), url) url,self._debug("JS read %d <= %s", len(data), url) ver):self._debug("JS read %d <= %s", len(data), ur... | 16,236 |
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 =... | defself._debug("JS: jsScript %s %s", ver, `script`) jsScriptself._debug("JS: jsScript %s %s", ver, `script`) (self,self._debug("JS: jsScript %s %s", ver, `script`) script,self._debug("JS: jsScript %s %s", ver, `script`) ver,self._debug("JS: jsScript %s %s", ver, `script`) item):self._debug("JS: jsScript %s %s", ver, `s... | 16,237 |
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... | defself._debug("JS: endScript") jsEndScriptself._debug("JS: endScript") (self,self._debug("JS: endScript") item):self._debug("JS: endScript") #self._debug("JS:self._debug("JS: endScript") endScript")self._debug("JS: endScript") assertself._debug("JS: endScript") len(self.buf)self._debug("JS: endScript") >=self._debug("... | 16,238 |
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... | defself._debug("JS: switching back to parse with") jsEndScriptself._debug("JS: switching back to parse with") (self,self._debug("JS: switching back to parse with") item):self._debug("JS: switching back to parse with") #self._debug("JS:self._debug("JS: switching back to parse with") endScript")self._debug("JS: switching... | 16,239 |
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... | 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... | 16,240 |
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... | class FixedHTMLTranslator (html4css1.HTMLTranslator): 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_k... | 16,241 |
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... | def visit_image(self, node): """ Like super.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 duplicat... | 16,242 |
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... | 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... | 16,243 |
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... | 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... | 16,244 |
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... | 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... | 16,245 |
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... | 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... | 16,246 |
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... | 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... | 16,247 |
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... | 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... | 16,248 |
def get_topframe_bashing (self): return """<script type="text/javascript"> | def get_topframe_bashing (self): return """<script type="text/javascript"> | 16,249 |
def get_topframe_bashing (self): return """<script type="text/javascript"> | def get_topframe_bashing (self): return """<script type="text/javascript"> | 16,250 |
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(... | def _test(): p = HtmlPrinter() 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("<a href=a />") ... | 16,251 |
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(... | def _test(): p = HtmlPrinter() p.feed("<hTml>") p.feed("<a href>") 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("<a href=a />") p.feed("</a>") p.feed("<?bla foo?>") p.feed("<?bla?>") p.feed("<!-- - ... | 16,252 |
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(... | 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.flush() | 16,253 |
def _broken (): p = HtmlPrinter() p.feed(""" """) p.flush() | def _broken (): p = HtmlPrinter() p.feed("") p.flush() | 16,254 |
def _broken (): p = HtmlPrinter() p.feed(""" """) p.flush() | def _broken (): p = HtmlPrinter() p.feed(""" """) p.flush() | 16,255 |
def _broken (): p = HtmlPrinter() for c in '<!-- -->': p.feed(c) p.flush() | def _broken (): p = HtmlPrinter() for c in '<a/>': p.feed(c) p.flush() | 16,256 |
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] | def remove_headers (headers, to_remove): """utility function to remove entries from RFC822 headers""" for h in to_remove: if headers.has_key(h): del headers[h] | 16,257 |
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... | 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... | 16,258 |
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) | 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) | 16,259 |
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... | 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.NIGHTMARE) wc.config['filters'] = ['Replacer', 'Rewriter', 'BinaryCharFilter'] wc.config.init_filter_modules() from wc.proxy import proxy_poll, run_ti... | 16,260 |
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... | 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... | 16,261 |
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... | 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... | 16,262 |
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... | 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... | 16,263 |
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... | defif 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.appen... | 16,264 |
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... | 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... | 16,265 |
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... | defif not server.headers.has_key('Content-Length'): server.headers['Connection'] = 'close\r' server_set_encoding_headersif not server.headers.has_key('Content-Length'): server.headers['Connection'] = 'close\r' (server,if not server.headers.has_key('Content-Length'): server.headers['Connection'] = 'close\r' filename=Non... | 16,266 |
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... | 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... | 16,267 |
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... | 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... | 16,268 |
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... | 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... | 16,269 |
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... | 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... | 16,270 |
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... | 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... | 16,271 |
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) | def getval (form, key): """return a formfield value""" if not form.has_key(key): return u'' return get_item_value(form[key]) | 16,272 |
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 ] | def getlist (form, key): """return a list of formfield values""" if not form.has_key(key): return [] 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... | 16,273 |
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... | 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... | 16,274 |
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 | def __init__ (self, opts): self.javascript = 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 | 16,275 |
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 | def __init__ (self, opts): self.js_filter = opts['javascript'] and jslib self.js_html = None self.js_src = False self.js_script = '' if self.javascript: self.js_env = jslib.new_jsenv() self.js_output = 0 self.js_popup = 0 | 16,276 |
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... | deferror(FILTER, "waited too long for %s"%self.state[1]) self.js_client.finish() self.js_html = None flusherror(FILTER, "waited too long for %s"%self.state[1]) self.js_client.finish() self.js_html = None (self):error(FILTER, "waited too long for %s"%self.state[1]) self.js_client.finish() self.js_html = None self._de... | 16,277 |
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... | def flush (self): self._debug("flush") if self.waited > 100: # waited too long; stop js background downloader and # switch back to parse self.state = ('parse',) self.feed("") # will replay() buffered data elif self.state[0]=='wait': # flushing in wait state raises a filter exception self.waited += 1 raise FilterWait("H... | 16,278 |
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... | 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("") # w... | 16,279 |
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... | 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... | 16,280 |
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... | 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... | 16,281 |
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. | 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. | 16,282 |
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) ... | 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) ... | 16,283 |
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... | 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... | 16,284 |
def fileno(self): return self.socket.fileno() | def fileno(self): return self.socket.fileno() | 16,285 |
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 ... | 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) port = 80 if host: host = host.lower() host, port = splitnport(host, 80) return scheme, host, port, ... | 16,286 |
def _form_removerule (rule): curfolder.rules.remove(rule) global currule currule = None info.append("Rule removed") | def _form_removerule (rule): curfolder.rules.remove(rule) global currule currule = None info.append(i18n._("Rule removed")) | 16,287 |
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") | 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(i18n._("Rewrite attribute added")) | 16,288 |
def _form_rewrite_removeattrs (form): toremove = getlist(form, 'delattr') if toremove: for attr in toremove: del currule.attrs[attr] info.append("Attributes removed") | def _form_rewrite_removeattrs (form): toremove = getlist(form, 'delattr') if toremove: for attr in toremove: del currule.attrs[attr] info.append(i18n._("Rewrite attributes removed")) | 16,289 |
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... | def _form_rule_titledesc (form): title = getval(form, 'rule_title') if not title: error.append(i18n._("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 descript... | 16,290 |
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... | 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(i18n._("Rule title changed")) desc = getval(form, 'rule_description') if desc!=currule.desc: currule.desc = desc info.append("Rule descript... | 16,291 |
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... | 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(i18n._("Rule descripti... | 16,292 |
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... | def _form_rule_matchurl (form): matchurl = getval(form, 'rule_matchurl').strip() if matchurl!=currule.matchurl: currule.matchurl = matchurl info.append(i18n._("Rule match url changed")) dontmatchurl = getval(form, 'rule_dontmatchurl').strip() if dontmatchurl!=currule.dontmatchurl: currule.dontmatchurl = dontmatchurl in... | 16,293 |
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... | 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... | 16,294 |
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_... | def _form_rule_urlparts (form): scheme = getval(form, 'rule_urlscheme').strip() if scheme!=currule.scheme: currule.scheme = scheme info.append(i18n._("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... | 16,295 |
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_... | 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(i18n._("Rule url host changed")) port = getval(form... | 16,296 |
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_... | 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_... | 16,297 |
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_... | 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_... | 16,298 |
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_... | 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_... | 16,299 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.