Пример #1
0
    def _cache_key(self, extra=''):
        """
        Compute a cache key for this queryset
        """
        md5 = hashlib.md5()
        md5.update(str(self.__class__))
        md5.update(stamp_fields(self.model)) # Protect from field list changes in model
        md5.update(stringify_query(self.query))
        if extra:
            md5.update(str(extra))
        # 'flat' attribute changes results formatting for ValuesQuerySet
        if hasattr(self, 'flat'):
            md5.update(str(self.flat))

        return 'q:%s' % md5.hexdigest()
Пример #2
0
    def _cache_key(self, extra=''):
        """
        Compute a cache key for this queryset
        """
        md5 = cross.md5()
        md5.update('%s.%s' % (self.__class__.__module__, self.__class__.__name__))
        md5.update(stamp_fields(self.model)) # Protect from field list changes in model
        md5.update(stringify_query(self.query))
        # If query results differ depending on database
        if self._cacheprofile and not self._cacheprofile['db_agnostic']:
            md5.update(self.db)
        if extra:
            md5.update(str(extra))
        # 'flat' attribute changes results formatting for ValuesQuerySet
        if hasattr(self, 'flat'):
            md5.update(str(self.flat))

        return 'q:%s' % md5.hexdigest()
Пример #3
0
    def _cache_key(self, extra=""):
        """
        Compute a cache key for this queryset
        """
        md5 = hashlib.md5()
        md5.update(str(self.__class__))
        md5.update(stamp_fields(self.model))  # Protect from field list changes in model
        md5.update(stringify_query(self.query))
        # If query results differ depending on database
        if not self._cacheprofile["db_agnostic"]:
            md5.update(self.db)
        if extra:
            md5.update(str(extra))
        # 'flat' attribute changes results formatting for ValuesQuerySet
        if hasattr(self, "flat"):
            md5.update(str(self.flat))

        return "q:%s" % md5.hexdigest()
Пример #4
0
    def _cache_key(self, extra=''):
        """
        Compute a cache key for this queryset
        """
        md5 = hashlib.md5()
        md5.update(str(self.__class__))
        md5.update(stamp_fields(
            self.model))  # Protect from field list changes in model
        md5.update(stringify_query(self.query))
        # If query results differ depending on database
        if not self._cacheprofile['db_agnostic']:
            md5.update(self.db)
        if extra:
            md5.update(str(extra))
        # 'flat' attribute changes results formatting for ValuesQuerySet
        if hasattr(self, 'flat'):
            md5.update(str(self.flat))

        return 'q:%s' % md5.hexdigest()