FraunhoferIOSB / FROST-Python-Client

Python Client Library for FROST.
GNU Lesser General Public License v3.0
8 stars 8 forks source link

Changed eq behaviour in 1.1.43 #24

Closed geomar-madolf closed 1 year ago

geomar-madolf commented 1 year ago

Hi,

in the new version with calls to the super().__eq__() a new criteria for equality was added for each object.

        if self.id != other.id:
            return False

Now, if I create a new object locally and want to check if it already exists on the server, the new object naturally has no id yet and the comparison fails.

@vogljonathan is this the intended behaviour? Is there an other way I should do this?

EDIT: I created a pull request for a possible solution

vogljonathan commented 1 year ago

You're right, I hadn't thought about the missing local id. I think including the ids if they exist is the best solution. However, I would prefer to check for none. With your suggestion in #25 , one can get into trouble with an id 0 (which is at least possible with user-generated ids).