Open chrisseto opened 10 years ago
remove
is a classmethod of StoredObject
, so the expected usage is something like Tag.remove(tag)
. But yes, remove
is still available from instances, which is confusing. Not sure how to improve this--thoughts welcome.
def remove(cls):
if isinstance(cls, StoredObject):
# Remove just the instance here
else:
# Remove everything here
Could that potentially work?
Well, cls
is always going to be passed as the schema class, never the instance. So I don't think so, unless I'm misunderstanding.
Right... sadly that doesnt work.
My suggestion under the advice of BrianG would be to rename the cls.remove
to cls.remove_all
and then implement instance.remove
as expected.
Assumptions we have a stored object called tag
The expected behavior would be that only t is removed from the backend