"""
-import sys, os, string
+import sys, os
import time, urllib
from base64 import b64encode
from urlparse import urljoin
# Fake headers to pretend this is a real browser
_version = "Links (2.1; Linux 2.6 i686; 80x25)"
urllib._urlopener.addheaders[0] = ('User-Agent', _version)
-_version = "bookmarks_db (Python %d.%d.%d; urllib/%s)" % (sys.version_info[:3], urllib.__version__)
+_version = "bookmarks_db (Python %d.%d.%d; urllib/%s)" % (
+ sys.version_info[0], sys.version_info[1], sys.version_info[2], urllib.__version__)
urllib._urlopener.addheader('X-User-Agent', _version)
urllib._urlopener.addheader('Connection', 'close')
def get_error(msg):
- if type(msg) == type(""):
+ if isinstance(msg, str):
return msg
else:
s = []
for i in msg:
- s.append("'%s'" % string.join(string.split(str(i), "\n"), "\\n"))
- return "(%s)" % string.join(s)
+ s.append("'%s'" % str(i).replace('\n', "\\n"))
+ return "(%s)" % ' '.join(s)
urllib_ftpwrapper = urllib.ftpwrapper
def __init__(self, user, passwd, host, port, dirs):
urllib_ftpwrapper.__init__(self, user, passwd, host, port, dirs)
global ftpcache_key
- ftpcache_key = (user, host, port, string.join(dirs, '/'))
+ ftpcache_key = (user, host, port, tuple(dirs))
urllib.ftpwrapper = myftpwrapper
if not icon:
icon = "/favicon.ico"
icon = urljoin("%s://%s%s" % (url_type, url_host, url_path), icon)
- if self.log: self.log(" looking for icon at : %s" % icon)
+ if self.log: self.log(" looking for icon at: %s" % icon)
try:
for i in range(8):
try: