Skip to content

Commit 87a4bca

Browse files
committed
reverted dot-notation feature for settings, causing downstream issues accessing attributes
1 parent 3b2d0ed commit 87a4bca

File tree

1 file changed

+1
-28
lines changed

1 file changed

+1
-28
lines changed

pyttman/core/internals.py

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@
66
from datetime import datetime
77
from pathlib import Path
88
from typing import Any
9-
import json
10-
from collections import UserDict
119

12-
import pytz
1310
import pyttman
1411
from pyttman.core.containers import MessageMixin, Reply
1512
from pyttman.core.decorators import LifecycleHookRepository
@@ -37,13 +34,6 @@ def depr_graceful(message: str, version: str):
3734
warnings.warn(out, DeprecationWarning)
3835

3936

40-
class CustomUserDict(UserDict):
41-
42-
def __init__(self, dictionary):
43-
self.data = dictionary
44-
self.__dict__.update(dictionary)
45-
46-
4737
class Settings:
4838
"""
4939
Dataclass holding settings configured in the settings.py
@@ -74,32 +64,15 @@ def __init__(self, dictionary=None, **kwargs):
7464
self.LOG_FORMAT: str | None = None
7565
self.LOG_TO_STDOUT: bool = False
7666
self.STATIC_FILES_DIR: Path | None = None
77-
self.TIME_ZONE: pytz.timezone = None
7867

79-
[self._set_attr(k, v) for k, v in kwargs.items()
68+
[setattr(self, k, v) for k, v in kwargs.items()
8069
if not inspect.ismodule(v)
8170
and not inspect.isfunction(v)]
8271

83-
def __getitem__(self, item):
84-
return self.__dict__[item]
85-
86-
def _set_attr(self, k, v):
87-
tmp = v
88-
if isinstance(v, dict):
89-
tmp = Settings._dict_to_object(v)
90-
91-
setattr(self, k, tmp)
92-
9372
def __repr__(self):
9473
_attrs = {name: value for name, value in self.__dict__.items()}
9574
return f"Settings({_attrs})"
9675

97-
@staticmethod
98-
def _dict_to_object(dictionary):
99-
return json.loads(json.dumps(dictionary), object_hook=Settings)
100-
101-
102-
10376
def _generate_name(name):
10477
"""
10578
Generates a user-friendly name out of

0 commit comments

Comments
 (0)