Mercurial > kallithea
comparison rhodecode/lib/utils.py @ 724:a9bc513a1fe3 beta
fixed nasty bug with ui()
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Fri, 19 Nov 2010 00:03:37 +0100 |
parents | cb0d9ce6ac5c |
children | dbec976d9975 |
comparison
equal
deleted
inserted
replaced
723:bf26b46e82d6 | 724:a9bc513a1fe3 |
---|---|
262 :param read_from: read from 'file' or 'db' | 262 :param read_from: read from 'file' or 'db' |
263 """ | 263 """ |
264 | 264 |
265 baseui = ui.ui() | 265 baseui = ui.ui() |
266 | 266 |
267 #clean the baseui object | |
268 baseui._ocfg = config.config() | |
269 baseui._ucfg = config.config() | |
270 baseui._tcfg = config.config() | |
271 | |
267 if read_from == 'file': | 272 if read_from == 'file': |
268 if not os.path.isfile(path): | 273 if not os.path.isfile(path): |
269 log.warning('Unable to read config file %s' % path) | 274 log.warning('Unable to read config file %s' % path) |
270 return False | 275 return False |
271 log.debug('reading hgrc from %s', path) | 276 log.debug('reading hgrc from %s', path) |
272 cfg = config.config() | 277 cfg = config.config() |
273 cfg.read(path) | 278 cfg.read(path) |
274 for section in ui_sections: | 279 for section in ui_sections: |
275 for k, v in cfg.items(section): | 280 for k, v in cfg.items(section): |
281 log.debug('settings ui from file[%s]%s:%s', section, k, v) | |
276 baseui.setconfig(section, k, v) | 282 baseui.setconfig(section, k, v) |
277 log.debug('settings ui from file[%s]%s:%s', section, k, v) | 283 |
278 | 284 |
279 elif read_from == 'db': | 285 elif read_from == 'db': |
280 hg_ui = get_hg_ui_cached() | 286 hg_ui = get_hg_ui_cached() |
281 for ui_ in hg_ui: | 287 for ui_ in hg_ui: |
282 if ui_.ui_active: | 288 if ui_.ui_active: |
283 log.debug('settings ui from db[%s]%s:%s', ui_.ui_section, ui_.ui_key, ui_.ui_value) | 289 log.debug('settings ui from db[%s]%s:%s', ui_.ui_section, ui_.ui_key, ui_.ui_value) |
284 baseui.setconfig(ui_.ui_section, ui_.ui_key, ui_.ui_value) | 290 baseui.setconfig(ui_.ui_section, ui_.ui_key, ui_.ui_value) |
285 | |
286 | |
287 return baseui | 291 return baseui |
288 | 292 |
289 | 293 |
290 def set_rhodecode_config(config): | 294 def set_rhodecode_config(config): |
291 hgsettings = get_hg_settings() | 295 hgsettings = get_hg_settings() |