equal
deleted
inserted
replaced
11 class Folder (filesystem.Directory) : |
11 class Folder (filesystem.Directory) : |
12 """ |
12 """ |
13 A Folder is a filesystem Directory that: |
13 A Folder is a filesystem Directory that: |
14 * has a title/description (XXX: Page) |
14 * has a title/description (XXX: Page) |
15 * contains any number of other sub-Folders and Images. |
15 * contains any number of other sub-Folders and Images. |
16 * can load custom configuration for itself and sub-nodes to override the base config |
16 * maintains a hierarchial Configuration that can be overrided for sub-nodes |
17 * holds sub-dirs for previews/thumbs |
17 * holds sub-dirs for previews/thumbs |
18 * has a HTML view |
18 * has a HTML view |
19 """ |
19 """ |
20 |
20 |
21 def iter_config_files (self) : |
21 def iter_config_files (self) : |
24 |
24 |
25 XXX: abstract this |
25 XXX: abstract this |
26 """ |
26 """ |
27 |
27 |
28 yield self.subfile('degal.cfg') |
28 yield self.subfile('degal.cfg') |
|
29 |
|
30 def _init_config (self) : |
|
31 """ |
|
32 Initialize .config for ourselves. |
|
33 """ |
|
34 |
|
35 # use parent's config |
|
36 return self.parent.config |
29 |
37 |
30 def __init__ (self, *args, **kwargs) : |
38 def __init__ (self, *args, **kwargs) : |
31 super(Folder, self).__init__(*args, **kwargs) |
39 super(Folder, self).__init__(*args, **kwargs) |
32 |
40 |
33 # find config |
41 # load .config |
|
42 self.config = self._init_config() |
|
43 |
|
44 # find custom config? |
34 for file in self.iter_config_files() : |
45 for file in self.iter_config_files() : |
35 if file.exists() : |
46 if file.exists() : |
36 # yay! More configuration! |
47 # yay! More configuration! |
37 self.config = self.config.load(file.path) |
48 self.config = self.config.load(file.path) |
38 |
49 |
44 self.title = self.config.title |
55 self.title = self.config.title |
45 |
56 |
46 # disable it so it won't be used by children |
57 # disable it so it won't be used by children |
47 # XXX: figure out a better way of doing this |
58 # XXX: figure out a better way of doing this |
48 self.config.title = None |
59 self.config.title = None |
49 |
60 |
50 @lazy_load |
61 @lazy_load |
51 def title (self) : |
62 def title (self) : |
52 """ |
63 """ |
53 Find the default title for this dir. |
64 Find the default title for this dir. |
54 """ |
65 """ |