Mercurial > kallithea
changeset 892:9adc0c1d9a87 beta
Added optional cache into get_application settings
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Wed, 29 Dec 2010 12:18:49 +0100 |
parents | cca7286401b3 |
children | ead7be02283b |
files | rhodecode/model/settings.py |
diffstat | 1 files changed, 5 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/rhodecode/model/settings.py Wed Dec 29 11:13:17 2010 +0100 +++ b/rhodecode/model/settings.py Wed Dec 29 12:18:49 2010 +0100 @@ -45,15 +45,16 @@ "get_setting_%s" % settings_key)) return r - def get_app_settings(self): + def get_app_settings(self, cache=False): """Get's config from database, each config key is prefixed with 'rhodecode_' prefix, than global pylons config is updated with such keys """ - ret = self.sa.query(RhodeCodeSettings)\ - .options(FromCache("sql_cache_short", - "get_hg_settings")).all() + ret = self.sa.query(RhodeCodeSettings) + + if cache: + ret = ret.options(FromCache("sql_cache_short", "get_hg_settings")) if not ret: raise Exception('Could not get application settings !')