woob.capabilities.collection
¶
- class CapCollection[source]¶
Bases:
Capability
- iter_resources_flat(objs, split_path, clean_only=False)[source]¶
Call iter_resources() to fetch all resources in the tree. If clean_only is True, do not explore paths, only remove them. split_path is used to set the starting path.
- iter_resources(objs, split_path)[source]¶
split_path is a list, either empty (root path) or with one or many components.
- get_collection(objs, split_path)[source]¶
Get a collection for a given split path. If the path is invalid (i.e. can’t be handled by this module), it should return None.
- validate_collection(objs, collection)[source]¶
Tests if a collection is valid. For compatibility reasons, and to provide a default way, it checks if the collection has at least one object in it. However, it is not very efficient or exact, and you are encouraged to override this method. You can replace the collection object entirely by returning a new one.
- class BaseCollection(split_path, id=None, url=None)[source]¶
Bases:
BaseObject
Inherit from this if you want to create an object that is also a Collection. However, this probably will not work properly for now.
- Variables:
url – (
str
) url
- property basename¶
- property parent_path¶
- property path_level¶
- class Collection(split_path=None, title=None, id=None, url=None)[source]¶
Bases:
BaseCollection
A Collection is a “fake” object returned in results, which shows you can get more results if you go into its path.
It is a dumb object, it must not contain callbacks to a backend.
Do not inherit from this class if you want to make a regular BaseObject a Collection, use BaseCollection instead.