fix: ensure current module is referenced correctly in __get_deprecation_class
This commit is contained in:
parent
c1cb375379
commit
4a4a2957c2
1 changed files with 1 additions and 1 deletions
|
|
@ -79,11 +79,11 @@ class V17FrappeDeprecationWarning(PendingFrappeDeprecationWarning):
|
||||||
|
|
||||||
|
|
||||||
def __get_deprecation_class(graduation: str | None = None, class_name: str | None = None) -> type:
|
def __get_deprecation_class(graduation: str | None = None, class_name: str | None = None) -> type:
|
||||||
|
current_module = sys.modules[__name__]
|
||||||
if graduation:
|
if graduation:
|
||||||
# Scrub the graduation string to ensure it's a valid class name
|
# Scrub the graduation string to ensure it's a valid class name
|
||||||
cleaned_graduation = re.sub(r"\W|^(?=\d)", "_", graduation.upper())
|
cleaned_graduation = re.sub(r"\W|^(?=\d)", "_", graduation.upper())
|
||||||
class_name = f"{cleaned_graduation}FrappeDeprecationWarning"
|
class_name = f"{cleaned_graduation}FrappeDeprecationWarning"
|
||||||
current_module = sys.modules[__name__]
|
|
||||||
try:
|
try:
|
||||||
return getattr(current_module, class_name)
|
return getattr(current_module, class_name)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue