

def __set__(self, obj, value):
    '\n        This accessor sets the proxied geometry with the geometry class\n        specified during initialization.  Values of None, HEXEWKB, or WKT may\n        be used to set the geometry as well.\n        '
    gtype = self._field.geom_type
    if (isinstance(value, self._klass) and ((str(value.geom_type).upper() == gtype) or (gtype == 'GEOMETRY'))):
        if (value.srid is None):
            value.srid = self._field.srid
    elif isinstance(value, (NoneType, StringType, UnicodeType)):
        pass
    else:
        raise TypeError(('cannot set %s GeometryProxy with value of type: %s' % (obj.__class__.__name__, type(value))))
    obj.__dict__[self._field.attname] = value
    return value

dataset/ETHPy150Open CollabQ/CollabQ/vendor/django/contrib/gis/db/models/proxy.py GeometryProxy.__set__/original