|
@@ -568,15 +568,12 @@ class StatsHttpd:
|
|
|
string variable and returns string. Template object includes
|
|
|
the variable. Limitation of a file size isn't needed there. XXXX"""
|
|
|
lines = None
|
|
|
- f = None
|
|
|
try:
|
|
|
- f = open(file_name, 'r')
|
|
|
- lines = "".join(f.readlines())
|
|
|
+ with open(file_name, 'r') as f:
|
|
|
+ lines = "".join(f.readlines())
|
|
|
except IOError as err:
|
|
|
raise StatsHttpdDataError(
|
|
|
"%s: %s" % (err.__class__.__name__, err))
|
|
|
- finally:
|
|
|
- if f: f.close()
|
|
|
return string.Template(lines)
|
|
|
|
|
|
if __name__ == "__main__":
|