Esempio n. 1
0
    def hashValue(self, value):
        
        view = self.itsView
        hash = _hash(str(self.itsPath))
        for k, v in value.iteritems():
            hash = _combine(hash, TypeHandler.hashValue(view, k))
            hash = _combine(hash, TypeHandler.hashValue(view, v))

        return hash
Esempio n. 2
0
    def hashValue(self, value):

        view = self.itsView
        hash = _hash(str(self.itsPath))
        for v in value:
            hash = _combine(hash, TypeHandler.hashValue(view, v))

        return hash
Esempio n. 3
0
    def _hashValues(self):

        item = self._item
        kind = item._kind
        view = item.itsView
        hash = 0

        names = self.keys()
        names.sort()
        
        for name in names:
            if kind is not None:
                attribute = kind.getAttribute(name, False, item)
            else:
                attribute = None

            if attribute is not None:
                persisted = attribute.getAspect('persisted', True)
            else:
                persisted = True

            if persisted:
                persisted = self._getFlags(name) & Values.TRANSIENT == 0

            if persisted:
                hash = _combine(hash, _hash(name))
                value = self[name]
                
                if attribute is not None:
                    attrType = attribute.getAspect('type')
                else:
                    attrType = None

                if attrType is not None:
                    hash = _combine(hash, attrType.hashValue(value))
                else:
                    hash = _combine(hash, TypeHandler.hashValue(view, value))

        return hash
Esempio n. 4
0
    def _hashValues(self):

        item = self._item
        kind = item._kind
        view = item.itsView
        hash = 0

        names = self.keys()
        names.sort()

        for name in names:
            if kind is not None:
                attribute = kind.getAttribute(name, False, item)
            else:
                attribute = None

            if attribute is not None:
                persisted = attribute.getAspect('persisted', True)
            else:
                persisted = True

            if persisted:
                persisted = self._getFlags(name) & Values.TRANSIENT == 0

            if persisted:
                hash = _combine(hash, _hash(name))
                value = self[name]

                if attribute is not None:
                    attrType = attribute.getAspect('type')
                else:
                    attrType = None

                if attrType is not None:
                    hash = _combine(hash, attrType.hashValue(value))
                else:
                    hash = _combine(hash, TypeHandler.hashValue(view, value))

        return hash
Esempio n. 5
0
    def hashValue(self, value):

        view = self.itsView
        hash = _hash(str(self.itsPath))

        fields = self.getAttributeValue('fields', self._values, None, None)
        if fields:
            for fieldName, field in fields.iteritems():
                default = self.getDefaultValue(fieldName) 
                fieldValue = self.getFieldValue(value, fieldName, default)
                if fieldValue == default:
                    continue
            
                fieldType = field.get('type', None)
                hash = _combine(hash, _hash(fieldName))
                if fieldType is not None:
                    hash = _combine(hash, fieldType.hashValue(fieldValue))
                else:
                    hash = _combine(hash, TypeHandler.hashValue(view,
                                                                fieldValue))

        return hash
Esempio n. 6
0
 def hashValue(hash, type, value):
     if type is not None:
         return _combine(hash, type.hashValue(value))
     else:
         return _combine(hash, TypeHandler.hashValue(view, value))
Esempio n. 7
0
    def hashValue(self, value):

        if value is None:
            return 0

        return TypeHandler.hashValue(self.itsView, SingleRef(value.itsUUID))