Move parseOptions to cgi.py

As it is no longer used in cli.py
master
pictuga 2020-08-22 00:37:34 +02:00
parent f79938ab11
commit baccd3b22b
2 changed files with 24 additions and 25 deletions

View File

@ -14,12 +14,34 @@ except ImportError:
from . import crawler from . import crawler
from . import readabilite from . import readabilite
from .morss import FeedFetch, FeedGather, FeedFormat from .morss import FeedFetch, FeedGather, FeedFormat
from .morss import Options, parseOptions from .morss import Options, log, DELAY, DEBUG, MorssException
from .morss import log, DELAY, DEBUG, MorssException
from . import cred from . import cred
def parseOptions(options):
""" Turns ['md=True'] into {'md':True} """
out = {}
for option in options:
split = option.split('=', 1)
if len(split) > 1:
if split[0].lower() == 'true':
out[split[0]] = True
elif split[0].lower() == 'false':
out[split[0]] = False
else:
out[split[0]] = split[1]
else:
out[split[0]] = True
return out
def cgi_parse_environ(environ): def cgi_parse_environ(environ):
# get options # get options

View File

@ -87,29 +87,6 @@ class Options:
return key in self.options return key in self.options
def parseOptions(options):
""" Turns ['md=True'] into {'md':True} """
out = {}
for option in options:
split = option.split('=', 1)
if len(split) > 1:
if split[0].lower() == 'true':
out[split[0]] = True
elif split[0].lower() == 'false':
out[split[0]] = False
else:
out[split[0]] = split[1]
else:
out[split[0]] = True
return out
def ItemFix(item, options, feedurl='/'): def ItemFix(item, options, feedurl='/'):
""" Improves feed items (absolute links, resolve feedburner links, etc) """ """ Improves feed items (absolute links, resolve feedburner links, etc) """