Merge pull request #3181 from volundmush/attr_fix

Small fix to the AttributeHandler.all(). Fixes #3160
This commit is contained in:
Griatch 2023-05-07 22:06:37 +02:00 committed by GitHub
commit a8da04f6cf

View file

@ -1390,11 +1390,12 @@ class AttributeHandler:
"""
self.backend.clear_attributes(category, accessing_obj, default_access)
def all(self, accessing_obj=None, default_access=True):
def all(self, category=None, accessing_obj=None, default_access=True):
"""
Return all Attribute objects on this object, regardless of category.
Args:
category (str, optional): A given category to limit results to.
accessing_obj (object, optional): Check the `attrread`
lock on each attribute before returning them. If not
given, this check is skipped.
@ -1408,6 +1409,8 @@ class AttributeHandler:
"""
attrs = self.backend.get_all_attributes()
if category:
attrs = [attr for attr in attrs if attr.category == category]
if accessing_obj:
return [