54
54
for view_name in config.sections:
55
log.debug('Configuring (project %s) branch %s...', name, view_name)
55
log.debug('Configuring (project %r) branch %r...', name, view_name)
56
56
self._add_view(view_name, config[view_name], config[view_name].get('folder'))
58
self._auto_folder = config.get('auto_publish_folder', None)
60
if self._auto_folder is not None:
61
self._recheck_auto_folders()
58
auto_folder = config.get('auto_publish_folder', None)
59
if auto_folder is not None:
61
# scan a folder for bazaar branches, and add them automatically
62
for path, folders, filenames in os.walk(auto_folder):
63
for folder in folders:
64
folder = os.path.join(path, folder)
66
auto_list.append(folder)
68
for folder in auto_list:
69
view_name = os.path.basename(folder)
70
log.debug('Auto-configuring (project %r) branch %r...', name, view_name)
71
self._add_view(view_name, ConfigObj(), folder)
63
def _recheck_auto_folders(self):
64
log.debug('recheck...')
65
if self._auto_folder is None:
68
# scan a folder for bazaar branches, and add them automatically
69
for path, folders, filenames in os.walk(self._auto_folder):
70
for folder in folders:
71
folder = os.path.join(path, folder)
73
auto_list.append(folder)
75
if auto_list == self._auto_list:
76
# nothing has changed; do nothing.
81
log.debug('Rescanning auto-folder for project %s ...', self.name)
83
for folder in auto_list:
84
view_name = os.path.basename(folder)
85
log.debug('Auto-configuring (project %s) branch %s...', self.name, view_name)
86
self._add_view(view_name, ConfigObj(), folder)
87
self._auto_list = auto_list
89
73
def _add_view(self, view_name, view_config, folder):
90
74
c_view_name = cherrypy_friendly(view_name)
91
75
view = BranchView(self.name, c_view_name, view_name, folder, view_config, self._config)
98
82
class Root (controllers.RootController):
99
def __init__(self, config):
100
84
self._projects = []
101
self._config = config
102
for project_name in self._config.sections:
85
for project_name in sys._loggerhead_config.sections:
103
86
c_project_name = cherrypy_friendly(project_name)
104
project = Project(c_project_name, self._config[project_name])
87
project = Project(c_project_name, sys._loggerhead_config[project_name])
105
88
self._projects.append(project)
106
89
setattr(self, c_project_name, project)
108
91
@turbogears.expose(template='loggerhead.templates.browse')
110
for p in self._projects:
111
p._recheck_auto_folders()
113
94
'projects': self._projects,
115
'title': self._config.get('title', ''),
96
'title': sys._loggerhead_config.get('title', ''),
119
99
def _check_rebuild(self):
120
100
for p in self._projects: