

def _validate(self, value):
    if self._indexed:
        if isinstance(value, unicode):
            value = value.encode('utf-8')
        if (isinstance(value, basestring) and (len(value) > _MAX_STRING_LENGTH)):
            raise datastore_errors.BadValueError(('Indexed value %s must be at most %d bytes' % (self._name, _MAX_STRING_LENGTH)))

dataset/ETHPy150Open GoogleCloudPlatform/datastore-ndb-python/ndb/model.py GenericProperty._validate/original