Move parseOptions to cgi.py
As it is no longer used in cli.py
This commit is contained in:
		
							
								
								
									
										26
									
								
								morss/cgi.py
									
									
									
									
									
								
							
							
						
						
									
										26
									
								
								morss/cgi.py
									
									
									
									
									
								
							@@ -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
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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) """
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user