filenames without _ (spare my pinkie)
[unfold.git] / engine / plugin.py
index 4ae6fbf..fc68c48 100644 (file)
@@ -14,7 +14,8 @@ from engine.prelude import Prelude
 # . [ 'SliceList', 'TabbedView' ] : to debug these classes
 # . True : to debug all plugin
 
-DEBUG= [ 'Tabs' ]
+#DEBUG= [ 'Tabs' ]
+DEBUG= False
 
 class Plugin:
 
@@ -106,11 +107,12 @@ class Plugin:
         # NOTE this plugin_uuid thing might occur in js files, ** do not rename **
         js_env = { 'plugin_uuid' : self.domid }
         js_env.update (self._settings)
+        for k in self.exclude_from_json():
+            if k in js_env: del js_env[k]
         settings_json = json.dumps (js_env, separators=(',',':'))
         env ['settings_json' ] = settings_json
         # compute plugin-specific initialization
-        js_init = render_to_string ( 'plugin_setenv.js', env )
-        print 'js_init',js_init
+        js_init = render_to_string ( 'plugin-setenv.js', env )
         self.add_js_chunks (request, js_init)
         
         # interpret the result of requirements ()
@@ -211,3 +213,6 @@ class Plugin:
 #                 'css_chunk': [],       # likewise for css scripts
 #                 }
     
+    # for better performance
+    # you can specify a list of keys that won't be exposed as json attributes
+    def exclude_from_json (self): return []