Minor layout adjustments

This commit is contained in:
Bernardo Damele 2010-06-10 14:14:56 +00:00
parent 660bf0b077
commit d3c8e461cf
2 changed files with 13 additions and 5 deletions

View File

@ -1366,19 +1366,26 @@ def getBruteUnicode(string):
class UnicodeRawConfigParser(RawConfigParser): class UnicodeRawConfigParser(RawConfigParser):
def write(self, fp): def write(self, fp):
"""Write an .ini-format representation of the configuration state.""" """
Write an .ini-format representation of the configuration state.
"""
if self._defaults: if self._defaults:
fp.write("[%s]\n" % DEFAULTSECT) fp.write("[%s]\n" % DEFAULTSECT)
for (key, value) in self._defaults.items(): for (key, value) in self._defaults.items():
fp.write("%s = %s\n" % (key, getUnicode(value).replace('\n', '\n\t'))) fp.write("%s = %s\n" % (key, getUnicode(value).replace('\n', '\n\t')))
fp.write("\n") fp.write("\n")
for section in self._sections: for section in self._sections:
fp.write("[%s]\n" % section) fp.write("[%s]\n" % section)
for (key, value) in self._sections[section].items(): for (key, value) in self._sections[section].items():
if key != "__name__": if key != "__name__":
if value is None: if value is None:
fp.write("%s\n" % (key)) fp.write("%s\n" % (key))
else: else:
fp.write("%s = %s\n" % fp.write("%s = %s\n" % (key, getUnicode(value).replace('\n', '\n\t')))
(key, getUnicode(value).replace('\n', '\n\t')))
fp.write("\n") fp.write("\n")

View File

@ -91,13 +91,15 @@ def __urllib2Opener():
logger.debug(debugMsg) logger.debug(debugMsg)
handlers = [proxyHandler, authHandler, redirectHandler] handlers = [proxyHandler, authHandler, redirectHandler]
if not conf.dropSetCookie: if not conf.dropSetCookie:
conf.cj = cookielib.LWPCookieJar() conf.cj = cookielib.LWPCookieJar()
handlers.append(urllib2.HTTPCookieProcessor(conf.cj)) handlers.append(urllib2.HTTPCookieProcessor(conf.cj))
if conf.keepAlive: if conf.keepAlive:
handlers.append(keepAliveHandler) handlers.append(keepAliveHandler)
opener = urllib2.build_opener(*handlers) opener = urllib2.build_opener(*handlers)
urllib2.install_opener(opener) urllib2.install_opener(opener)
def __feedTargetsDict(reqFile, addedTargetUrls): def __feedTargetsDict(reqFile, addedTargetUrls):
@ -702,7 +704,6 @@ def __setHTTPExtraHeaders():
if header and value: if header and value:
conf.httpHeaders.append((header, value)) conf.httpHeaders.append((header, value))
else: else:
conf.httpHeaders.append(("Accept", "text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5")) conf.httpHeaders.append(("Accept", "text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5"))
conf.httpHeaders.append(("Accept-Language", "en-us,en;q=0.5")) conf.httpHeaders.append(("Accept-Language", "en-us,en;q=0.5"))