ActionView
Overview
Presents a fixed action to a permission check, delegating every other attribute (get_queryset() included) to the wrapped view unchanged.
A permission class reads view.action to decide which named permission a request needs -- for example list versus read for two actions that both use GET. Wrapping the view this way lets a caller check authorization for one specific action, independently of whatever action the surrounding response is actually for, without mutating the wrapped view's own action attribute. get_queryset(), reached through this wrapper, still runs as a bound method of the wrapped view and reads that view's real action, so it keeps building whatever queryset the actual request would have built.
__class__ reports the wrapped view's own class rather than ActionView itself, so isinstance(action_view, ViewSet) is true and a viewset method invoked unbound with this wrapper standing in for self (:func:vueda.core.permissions.check_action_permission does exactly this for check_object_permissions) can still reach its own base implementation through a bare, zero-argument super() call -- that call requires self to appear as an instance of the class defining the method, which this wrapper otherwise would not. Delegation through __getattr__ is what keeps that safe: a method reached that way still runs bound to the real view, so this spoof only ever affects the one direct isinstance check, never which object a nested call like get_queryset() actually runs against.
__init__
Signature
__init__(view, action)
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| view | yes | |||
| action | yes |
Source
server/vueda/core/utils.py:95
action
Source
server/vueda/core/utils.py:71