cleaned style on the slice page and fixed menu
[unfold.git] / portal / theme.py
index 7d988b1..d44b854 100644 (file)
@@ -1,4 +1,6 @@
+import os
 from myslice.configengine import ConfigEngine
+from myslice.settings import TEMPLATE_DIRS
 
 class ThemeView (object):
     
@@ -10,4 +12,15 @@ class ThemeView (object):
     
     @property
     def template(self):
-        return self.theme + '/' + self.template_name
\ No newline at end of file
+        # Load a template from the theme directory if it exists
+        # else load it from the common templates dir
+        print "THEME = ",self.theme
+        print "TEMPLATE = ",self.template_name
+        print "TEMPLATE_DIRS = ",TEMPLATE_DIRS
+        filename = self.theme + '_' + self.template_name
+        print any(os.path.exists(os.path.join(d,filename)) for d in TEMPLATE_DIRS)
+        print (os.path.exists(os.path.join(d,filename)) for d in TEMPLATE_DIRS)
+        if any(os.path.exists(os.path.join(d,filename)) for d in TEMPLATE_DIRS):
+            return filename
+        else:
+            return self.template_name