diff -r 0db16d6b3617 -r 4ebd563214d2 degal/gallery.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/degal/gallery.py Fri Jun 05 21:50:49 2009 +0300 @@ -0,0 +1,48 @@ +""" + Top-level gallery state +""" + +import filesystem, folder, resources + +from utils import lazy_load + +class Gallery (filesystem.Root, folder.Folder) : + """ + A Gallery is a single place in the filesystem which acts as a Folder of Images, but had some additional stuff + """ + + def __init__ (self, path, config) : + """ + Build a Gallery rooted at the given filesystem path, and using the given user configuration. + + XXX: replace path with config.gallery_path? + """ + + super(Gallery, self).__init__(path, config) + + @lazy_load + def degal_dir (self) : + """ + The dir containing the degal configuration. + + It will be created if it does not exist. + """ + + return self.subdir('degal', create=True) + + @lazy_load + def stylesheet (self) : + """ + The stylesheet file. + + It will be copied from internal resources if it does not exist. + """ + + stylesheet = self.degal_dir.subfile('style.css') + + if not stylesheet : + # copy it from resources + stylesheet.copy_from(resources.STATIC_DIR.subfile('style.css')) + + return stylesheet +