web/propertysheet.py
branchstable
changeset 6000 98ca82aae3a1
parent 5938 9cb13d1b2ce4
child 7083 b8e35cde46e9
--- a/web/propertysheet.py	Tue Jul 20 16:45:11 2010 +0200
+++ b/web/propertysheet.py	Wed Jul 21 11:28:30 2010 +0200
@@ -23,6 +23,10 @@
 import os
 import os.path as osp
 
+TYPE_CHECKS = [('STYLESHEETS', list), ('JAVASCRIPTS', list),
+               ('STYLESHEETS_IE', list), ('STYLESHEETS_PRINT', list),
+               ]
+
 class lazystr(object):
     def __init__(self, string, context):
         self.string = string
@@ -54,6 +58,11 @@
         scriptglobals = self.context.copy()
         scriptglobals['__file__'] = fpath
         execfile(fpath, scriptglobals, self)
+        for name, type in TYPE_CHECKS:
+            if name in self:
+                if not isinstance(self[name], type):
+                    msg = "Configuration error: %s.%s should be a %s" % (fpath, name, type)
+                    raise Exception(msg)
         self._propfile_mtime[fpath] = os.stat(fpath)[-2]
         self._ordered_propfiles.append(fpath)