Browse Source

Small code clean up

tags/v1.1
pictuga 1 year ago
parent
commit
679628c7fa
3 changed files with 5 additions and 2 deletions
  1. +1
    -0
      main.py
  2. +4
    -0
      morss/feedify.py
  3. +0
    -2
      morss/morss.py

+ 1
- 0
main.py View File

@@ -1,4 +1,5 @@
#!/usr/bin/env python

from morss import main, cgi_wrapper as application

if __name__ == '__main__':


+ 4
- 0
morss/feedify.py View File

@@ -39,9 +39,11 @@ def get_rule(link):
for section in config.sections():
values = dict(config.items(section))
values['path'] = values['path'].split('\n')[1:]

for path in values['path']:
if fnmatch(link, path):
return values

return False


@@ -115,6 +117,7 @@ def pre_worker(url):

class Builder(object):
def __init__(self, link, data, rule=None):
# data must be a unicode string

self.link = link
self.data = data
@@ -130,6 +133,7 @@ class Builder(object):

if self.rule['mode'] == 'xpath':
self.doc = lxml.html.fromstring(self.data)

elif self.rule['mode'] == 'json':
self.doc = json.loads(self.data)



+ 0
- 2
morss/morss.py View File

@@ -562,8 +562,6 @@ def cgi_app(environ, start_response):
if not options.silent:
return out

log('done')


def cgi_wrapper(environ, start_response):
# simple http server for html and css


Loading…
Cancel
Save