Skip to content

Commit

Permalink
Add reader for .indexignore.
Browse files Browse the repository at this point in the history
  • Loading branch information
skytreader committed Jul 4, 2021
1 parent 72b1d3a commit 81cac86
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions main.py
@@ -1,5 +1,23 @@
from bottle import route, run

class IndexIgnore(object):

def __init__(self, ignorefilename):
self.ignores = set()
with open(ignorefilename) as ignorefile:
for line in ignorefile:
self.ignores.add(self.__normalize_dirname(line))

def __normalize_dirname(self, dirname):
dir_stripped = dirname.strip()
if dir_stripped[-1] == '/':
return dir_stripped[:-1]

return dir_stripped

def should_ignore(self, dirname):
return self.__normalize_dirname(dirname) in self.ignores

@route("/")
def root():
return "Welcome to Arundel"
Expand Down

0 comments on commit 81cac86

Please sign in to comment.