Skip to content

Commit

Permalink
Merge pull request #8 from w3c/jgraham/headers
Browse files Browse the repository at this point in the history
Make sure to close .headers files when we are done with them
  • Loading branch information
jgraham committed Mar 4, 2014
2 parents 5017d06 + 4c4d3cb commit 959fe6c
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions wptserve/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,11 @@ def get_headers(self, path):
return rv

def load_headers(self, path):
try:
headers_file = open(path + ".headers")
except IOError:
return []
else:
with open(path + ".headers") as headers_file:
return [tuple(item.strip() for item in line.split(":", 1))
for line in headers_file if line]
except IOError:
return []

def get_data(self, response, path, byte_ranges):
with open(path) as f:
Expand Down

0 comments on commit 959fe6c

Please sign in to comment.