mirror of
https://github.com/JimmXinu/FanFicFare.git
synced 2025-12-25 18:24:49 +01:00
Little cleanup & name normalize.
This commit is contained in:
parent
58402ea6e5
commit
a5f6770589
3 changed files with 10 additions and 8 deletions
|
|
@ -15,6 +15,8 @@
|
|||
# limitations under the License.
|
||||
#
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import print_function
|
||||
from optparse import OptionParser, SUPPRESS_HELP
|
||||
from os.path import expanduser, join, dirname
|
||||
from os import access, R_OK
|
||||
|
|
@ -264,7 +266,7 @@ def main(argv=None,
|
|||
options.cookiejar = cl.LWPCookieJar()
|
||||
options.cookiejar.load('global_cookies')
|
||||
except Exception as e:
|
||||
print("didn't load global_cache %s"%e)
|
||||
print("Didn't load global_cache %s"%e)
|
||||
|
||||
if not list_only:
|
||||
if len(urls) < 1:
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ import codecs
|
|||
|
||||
# py2 vs py3 transition
|
||||
import six
|
||||
import six.moves.configparser as ConfigParser
|
||||
from six.moves import configparser
|
||||
from six.moves.configparser import DEFAULTSECT, MissingSectionHeaderError, ParsingError
|
||||
from six.moves import urllib
|
||||
from six.moves.urllib.request import (build_opener, HTTPCookieProcessor)
|
||||
|
|
@ -495,11 +495,11 @@ def make_generate_cover_settings(param):
|
|||
return vlist
|
||||
|
||||
|
||||
class Configuration(ConfigParser.SafeConfigParser):
|
||||
class Configuration(configparser.SafeConfigParser):
|
||||
|
||||
def __init__(self, sections, fileform, lightweight=False):
|
||||
site = sections[-1] # first section is site DN.
|
||||
ConfigParser.SafeConfigParser.__init__(self)
|
||||
configparser.SafeConfigParser.__init__(self)
|
||||
|
||||
self.lightweight = lightweight
|
||||
self.use_pagecache = False # default to false for old adapters.
|
||||
|
|
@ -650,7 +650,7 @@ class Configuration(ConfigParser.SafeConfigParser):
|
|||
val = False
|
||||
#print("getConfig(%s)=[%s]%s" % (key,section,val))
|
||||
break
|
||||
except (ConfigParser.NoOptionError, ConfigParser.NoSectionError) as e:
|
||||
except (configparser.NoOptionError, configparser.NoSectionError) as e:
|
||||
pass
|
||||
|
||||
for section in sections[::-1]:
|
||||
|
|
@ -658,7 +658,7 @@ class Configuration(ConfigParser.SafeConfigParser):
|
|||
try:
|
||||
val = val + self.get(section,"add_to_"+key)
|
||||
#print("getConfig(add_to_%s)=[%s]%s" % (key,section,val))
|
||||
except (ConfigParser.NoOptionError, ConfigParser.NoSectionError) as e:
|
||||
except (configparser.NoOptionError, configparser.NoSectionError) as e:
|
||||
pass
|
||||
|
||||
return val
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2011 Fanficdownloader team, 2015 FanFicFare team
|
||||
# Copyright 2011 Fanficdownloader team, 2018 FanFicFare team
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
|
|
@ -86,7 +86,7 @@ def removeEntities(text, space_only=False):
|
|||
return unicode(text)
|
||||
|
||||
try:
|
||||
t = text #.decode('utf-8')
|
||||
t = text
|
||||
except (UnicodeEncodeError,UnicodeDecodeError) as e:
|
||||
try:
|
||||
t = text.encode ('ascii', 'xmlcharrefreplace')
|
||||
|
|
|
|||
Loading…
Reference in a new issue