# HG changeset patch # User Marcin Kuzminski # Date 2010-12-29 11:18:49 # Node ID 9adc0c1d9a87fa589a7a5a605c57f3a9f6d6b938 # Parent cca7286401b38b0a5d3e9b038941f7cbfdc078b7 Added optional cache into get_application settings diff --git a/rhodecode/model/settings.py b/rhodecode/model/settings.py --- a/rhodecode/model/settings.py +++ b/rhodecode/model/settings.py @@ -45,15 +45,16 @@ class SettingsModel(BaseModel): "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 !')