equal
deleted
inserted
replaced
27 |
27 |
28 httplib = util.httplib |
28 httplib = util.httplib |
29 stringio = util.stringio |
29 stringio = util.stringio |
30 urlerr = util.urlerr |
30 urlerr = util.urlerr |
31 urlreq = util.urlreq |
31 urlreq = util.urlreq |
|
32 |
|
33 def escape(s, quote=None): |
|
34 '''Replace special characters "&", "<" and ">" to HTML-safe sequences. |
|
35 If the optional flag quote is true, the quotation mark character (") |
|
36 is also translated. |
|
37 |
|
38 This is the same as cgi.escape in Python, but always operates on |
|
39 bytes, whereas cgi.escape in Python 3 only works on unicodes. |
|
40 ''' |
|
41 s = s.replace(b"&", b"&") |
|
42 s = s.replace(b"<", b"<") |
|
43 s = s.replace(b">", b">") |
|
44 if quote: |
|
45 s = s.replace(b'"', b""") |
|
46 return s |
32 |
47 |
33 class passwordmgr(object): |
48 class passwordmgr(object): |
34 def __init__(self, ui, passwddb): |
49 def __init__(self, ui, passwddb): |
35 self.ui = ui |
50 self.ui = ui |
36 self.passwddb = passwddb |
51 self.passwddb = passwddb |