Changeset - 8530c3cd9d04
[Not reviewed]
beta
0 1 0
Marcin Kuzminski - 14 years ago 2012-02-21 19:09:18
marcin@python-works.com
fixed issue with hybrid property for ldap_active
- some small fixes for cache_keys functions
1 file changed with 16 insertions and 3 deletions:
0 comments (0 inline, 0 general)
rhodecode/model/db.py
Show inline comments
 
@@ -165,7 +165,7 @@ class RhodeCodeSetting(Base, BaseModel):
 
    @hybrid_property
 
    def app_settings_value(self):
 
        v = self._app_settings_value
 
        if v == 'ldap_active':
 
        if self.app_settings_name == 'ldap_active':
 
            v = str2bool(v)
 
        return v
 

	
 
@@ -446,6 +446,7 @@ class UsersGroupMember(Base, BaseModel):
 
        self.users_group_id = gr_id
 
        self.user_id = u_id
 

	
 

	
 
class Repository(Base, BaseModel):
 
    __tablename__ = 'repositories'
 
    __table_args__ = (
 
@@ -1027,6 +1028,19 @@ class CacheInvalidation(Base, BaseModel)
 
                                  self.cache_id, self.cache_key)
 

	
 
    @classmethod
 
    def _get_key(cls, key):
 
        """
 
        Wrapper for generating a key
 

	
 
        :param key:
 
        """
 
        return "%s" % (key)
 

	
 
    @classmethod
 
    def get_by_key(cls, key):
 
        return cls.query().filter(cls.cache_key == key).scalar()
 

	
 
    @classmethod
 
    def invalidate(cls, key):
 
        """
 
        Returns Invalidation object if this given key should be invalidated
 
@@ -1071,8 +1085,7 @@ class CacheInvalidation(Base, BaseModel)
 

	
 
        :param key:
 
        """
 
        inv_obj = CacheInvalidation.query()\
 
            .filter(CacheInvalidation.cache_key == key).scalar()
 
        inv_obj = cls.get_by_key(key)
 
        inv_obj.cache_active = True
 
        Session.add(inv_obj)
 
        Session.commit()
0 comments (0 inline, 0 general)