Changeset - 9adc0c1d9a87
[Not reviewed]
beta
0 1 0
Marcin Kuzminski - 15 years ago 2010-12-29 12:18:49
marcin@python-works.com
Added optional cache into get_application settings
1 file changed with 5 insertions and 4 deletions:
0 comments (0 inline, 0 general)
rhodecode/model/settings.py
Show inline comments
 
@@ -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 !')
0 comments (0 inline, 0 general)