Пример #1
0
    def get_common_settings_list_by_name(self, name):
        cached_rules = RedisCache.find_cached_value('goose_common_settings_list_' + name)
        if cached_rules:
            return cached_rules

        query_string = "SELECT * FROM goose_common_settings WHERE name='%s'" %(name)
        records = self.get_records_list_by_query(query_string)

        common_settings_list = []
        for item in records:
            if item[4]:
                common_settings_list.append({'attribute': item[2], 'value': item[3]})

        RedisCache.cache_value('goose_common_settings_list_' + name, common_settings_list)
        return common_settings_list
Пример #2
0
        def fget(self):
            cached_rules = RedisCache.find_cached_value('goose_known_host_content_tags')
            if cached_rules:
                return cached_rules           

            query_string = 'SELECT domains.url, goose_domain_settings.*, domains.url FROM goose_domain_settings INNER JOIN domains ON goose_domain_settings.domain_id=domains.id'
            records = self.get_records_list_by_query(query_string)

            data = {}
            for item in records:
                if item[7]:
                    if item[5] != None : data[item[0]] = item[5]
                    if item[4] != None : data[item[0]] = {'reference' : self.get_domain_reference(records, item[4])}
                    # if item[3] != None : data['regexs_references'] = {item[3] : {'reference' : self.get_domain_reference(records, item[4])}}

            RedisCache.cache_value('goose_known_host_content_tags', data)
            return data