web/propertysheet.py
changeset 5938 9cb13d1b2ce4
parent 5467 57372dbfd114
child 6000 98ca82aae3a1
--- a/web/propertysheet.py	Thu Jul 08 12:54:25 2010 +0200
+++ b/web/propertysheet.py	Thu Jul 08 12:54:27 2010 +0200
@@ -23,6 +23,13 @@
 import os
 import os.path as osp
 
+class lazystr(object):
+    def __init__(self, string, context):
+        self.string = string
+        self.context = context
+    def __str__(self):
+        return self.string % self.context
+
 
 class PropertySheet(dict):
     def __init__(self, cache_directory, **context):
@@ -30,8 +37,12 @@
         self.context = context
         self.reset()
         context['sheet'] = self
+        context['lazystr'] = self.lazystr
         self._percent_rgx = re.compile('%(?!\()')
 
+    def lazystr(self, str):
+        return lazystr(str, self)
+
     def reset(self):
         self.clear()
         self._ordered_propfiles = []