Skip to content

Commit

Permalink
fix: Add **kwargs to skeleton meta classes (#1314)
Browse files Browse the repository at this point in the history
This allows to use `__init_subclass__` with parameters
  • Loading branch information
sveneberth authored Nov 11, 2024
1 parent e33f1d9 commit 8bbb839
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/viur/core/skeleton.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,13 @@ class MetaBaseSkel(type):

__allowed_chars = string.ascii_letters + string.digits + "_"

def __init__(cls, name, bases, dct):
def __init__(cls, name, bases, dct, **kwargs):
cls.__boneMap__ = MetaBaseSkel.generate_bonemap(cls)

if not getSystemInitialized() and not cls.__name__.endswith(ABSTRACT_SKEL_CLS_SUFFIX):
MetaBaseSkel._allSkelClasses.add(cls)

super(MetaBaseSkel, cls).__init__(name, bases, dct)
super().__init__(name, bases, dct)

@staticmethod
def generate_bonemap(cls):
Expand Down Expand Up @@ -544,8 +544,8 @@ def __new__(cls, *args, **kwargs) -> SkeletonInstance:


class MetaSkel(MetaBaseSkel):
def __init__(cls, name, bases, dct):
super(MetaSkel, cls).__init__(name, bases, dct)
def __init__(cls, name, bases, dct, **kwargs):
super().__init__(name, bases, dct, **kwargs)
relNewFileName = inspect.getfile(cls) \
.replace(str(conf.instance.project_base_path), "") \
.replace(str(conf.instance.core_base_path), "")
Expand Down

0 comments on commit 8bbb839

Please sign in to comment.