aboutsummaryrefslogtreecommitdiff
path: root/lib/templating.py
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2011-03-01 17:09:27 -0500
committerNick Mathewson <nickm@torproject.org>2011-03-01 17:09:27 -0500
commit1effffab2a161898dd916a14e92546990c970184 (patch)
tree0e2fae46742841cea8ba1ebb1fcc238e4a5eef62 /lib/templating.py
parent92c590397d7df286370ca30a78bfe4c69e5eff4b (diff)
downloadchutney-1effffab2a161898dd916a14e92546990c970184.tar
chutney-1effffab2a161898dd916a14e92546990c970184.tar.gz
Make it able to start, stop, and monitor tor networks. still very rough.
Diffstat (limited to 'lib/templating.py')
-rw-r--r--lib/templating.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/templating.py b/lib/templating.py
index 1fe3465..cc1463a 100644
--- a/lib/templating.py
+++ b/lib/templating.py
@@ -128,6 +128,7 @@ class IncluderDict(_DictWrapper):
def __init__(self, parent, includePath=(".",)):
_DictWrapper.__init__(self, parent)
self._includePath = includePath
+ self._st_mtime = 0
def _getitem(self, key):
if not key.startswith("include:"):
@@ -136,16 +137,25 @@ class IncluderDict(_DictWrapper):
filename = key[len("include:"):]
if os.path.isabs(filename):
with open(filename, 'r') as f:
+ stat = os.fstat(f.fileno())
+ if stat.st_mtime > self._st_mtime:
+ self._st_mtime = stat.st_mtime
return f.read()
for elt in self._includePath:
fullname = os.path.join(elt, filename)
if os.path.exists(fullname):
with open(fullname, 'r') as f:
+ stat = os.fstat(f.fileno())
+ if stat.st_mtime > self._st_mtime:
+ self._st_mtime = stat.st_mtime
return f.read()
raise KeyError(key)
+ def getUpdateTime(self):
+ return self._st_mtime
+
class _BetterTemplate(string.Template):
idpattern = r'[a-z0-9:_/\.\-]+'