Merge branch 'fibre' of ssh://git.onelab.eu/git/myslice into fibre
[unfold.git] / myslice / theme.py
1 import os
2 from myslice.configengine import ConfigEngine
3 from myslice.settings import TEMPLATE_DIRS
4
5 class ThemeView (object):
6     
7     @property
8     def theme(self):
9         self.config = ConfigEngine()
10         if self.config.myslice.theme :
11             return self.config.myslice.theme
12     
13     @property
14     def template(self):
15         # Load a template from the theme directory if it exists
16         # else load it from the common templates dir
17         #print "THEME = ",self.theme
18         #print "TEMPLATE = ",self.template_name
19         #print "TEMPLATE_DIRS = ",TEMPLATE_DIRS
20         filename = self.theme + '_' + self.template_name
21         #print any(os.path.exists(os.path.join(d,filename)) for d in TEMPLATE_DIRS)
22         #print (os.path.exists(os.path.join(d,filename)) for d in TEMPLATE_DIRS)
23         if any(os.path.exists(os.path.join(d,filename)) for d in TEMPLATE_DIRS):
24             return filename
25         else:
26             return self.template_name