Tips & Tricks
Dynamic Scope using Enums
The Problem
Solution - Dynamic Scope using Enum for context
Overview
Setup
# statusMixin.py
from .statusScope import StatusScope
class StatusMixin:
"""Mixin to add methods for status filtering"""
def boot_StatusMixin(self, builder):
if not hasattr(self, "__statuses__"):
raise AttributeError("__statuses__ is not defined")
builder.set_global_scope(StatusScope(getattr(self, "__statuses__")))Usage
Last updated