Преглед изворни кода

Add the ability to mark a value as derived at runtime.

Some jobs, like parsing the obs4_bridgeline file, don't belong in
Chutney.  Fortunately, our template-and-environment system makes
those easy to override.
Nick Mathewson пре 5 година
родитељ
комит
fa0bc73bee
1 измењених фајлова са 7 додато и 0 уклоњено
  1. 7 0
      lib/chutney/TorNet.py

+ 7 - 0
lib/chutney/TorNet.py

@@ -278,6 +278,13 @@ class Node(object):
     def specialize(self, **kwargs):
         return Node(parent=self, **kwargs)
 
+    def set_runtime(self, key, fn):
+        """Specify a runtime function that gets invoked to find the
+           runtime value of a key.  It should take a single argument, which
+           will be an environment.
+        """
+        setattr(self._env, "_get_"+key, fn)
+
     ######
     # Chutney uses these: