Repository: evennia/evennia

Issue:
[BUG] Attributes.all() unexpected keyword argument 'category'
#### Describe the bug
In the Evennia docs for Attributes, the example code shows passing a category when calling .all(). I am receiving this error:
`
ch_skills = self.caller.attributes.all(category="skill")
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: AttributeHandler.all() got an unexpected keyword argument 'category'
`

#### To Reproduce
Steps to reproduce the behavior:
1. create attributes with category "skill" on Character
2. verify you can pull values with Attributes.get("skillname", category="skill")
3. create a command function to pull all skill attributes from character
4. ch_skills = self.caller.attributes.all(category="skill")
5. execute
6. See error


#### Expected behavior
- you should be able to pass a category to Attributes.all() according to the example here: https://www.evennia.com/docs/latest/Components/Attributes.html
- however, Attributes.all() doesn't accept a category in the API doc here: https://www.evennia.com/docs/latest/api/evennia.typeclasses.attributes.html#evennia.typeclasses.attributes.AttributeHandler

#### Environment, Evennia version, OS etc
Windows 11
    Evennia 1.2.1 (rev cad60da)
    OS: nt
    Python: 3.11.1
    Twisted: 22.10.0
    Django: 4.1.7

#### Additional context
Not sure which source is the correct one. Being able to filter out all Attributes of a specific category & getting key/values would be great, A working alternative is .get(return_obj=True, category="skill")

[BUG] Attributes.all() unexpected keyword argument 'category'
#### Describe the bug
In the Evennia docs for Attributes, the example code shows passing a category when calling .all(). I am receiving this error:
`
ch_skills = self.caller.attributes.all(category="skill")
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: AttributeHandler.all() got an unexpected keyword argument 'category'
`

#### To Reproduce
Steps to reproduce the behavior:
1. create attributes with category "skill" on Character
2. verify you can pull values with Attributes.get("skillname", category="skill")
3. create a command function to pull all skill attributes from character
4. ch_skills = self.caller.attributes.all(category="skill")
5. execute
6. See error


#### Expected behavior
- you should be able to pass a category to Attributes.all() according to the example here: https://www.evennia.com/docs/latest/Components/Attributes.html
- however, Attributes.all() doesn't accept a category in the API doc here: https://www.evennia.com/docs/latest/api/evennia.typeclasses.attributes.html#evennia.typeclasses.attributes.AttributeHandler

#### Environment, Evennia version, OS etc
Windows 11
    Evennia 1.2.1 (rev cad60da)
    OS: nt
    Python: 3.11.1
    Twisted: 22.10.0
    Django: 4.1.7

#### Additional context
Not sure which source is the correct one. Being able to filter out all Attributes of a specific category & getting key/values would be great, A working alternative is .get(return_obj=True, category="skill")



Discussion:

Resolving patch:
diff --git a/evennia/typeclasses/attributes.py b/evennia/typeclasses/attributes.py
--- a/evennia/typeclasses/attributes.py
+++ b/evennia/typeclasses/attributes.py
@@ -1390,11 +1390,12 @@ def clear(self, category=None, accessing_obj=None, default_access=True):
         """
         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 @@ def all(self, accessing_obj=None, default_access=True):
 
         """
         attrs = self.backend.get_all_attributes()
+        if category:
+            attrs = [attr for attr in attrs if attr.category == category]
 
         if accessing_obj:
             return [


Test patch: