Improve themeing support. Test theme.

portnov [2008-06-05 15:29:53]
Improve themeing support. Test theme.
Filename
modules.py
modules/test2.pyc
test.py
themes.py
diff --git a/modules.py b/modules.py
index 1bbc23b..5ea81cc 100644
--- a/modules.py
+++ b/modules.py
@@ -11,7 +11,7 @@ import os.path

 from hooks import *
 from themes import *
-from generated import *
+from generate import *

 MODS_DIR = "modules"
 modules = {}
diff --git a/modules/test2.pyc b/modules/test2.pyc
index 61f7d98..c6c7742 100644
Binary files a/modules/test2.pyc and b/modules/test2.pyc differ
diff --git a/test.py b/test.py
index 896b184..04457b3 100755
--- a/test.py
+++ b/test.py
@@ -1,13 +1,27 @@
 #!/usr/bin/python

+import os.path
+
 import modules
 from hooks import *
-
+from themes import *
 modules.init()

+THEME = "default"
+
 @hook
 def do_something(s):
   print "Doing something with",s

+
+@themeable
+def page(path):
+  return "Content for "+path
+
 print "All modules loaded."
-do_something('anything')
+
+th= __import__(os.path.join("themes",THEME,"theme"))
+th.override = override
+th.init()
+
+print theme('page','/')
diff --git a/themes.py b/themes.py
index 72cd1f3..8b642c8 100644
--- a/themes.py
+++ b/themes.py
@@ -7,7 +7,6 @@ def themeable(func):
   name = func.__name__
   themed[name] = func
   def wrapper(*args,**kwargs):
-    print themed
     return (themed[name])(*args,**kwargs)
   wrapper.__name__ = name
   return wrapper
ViewGit