Skip to content

Commit

Permalink
victory
Browse files Browse the repository at this point in the history
  • Loading branch information
zaharazod committed Jan 22, 2025
1 parent f229e60 commit ebf9bbc
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 21 deletions.
2 changes: 1 addition & 1 deletion awa/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
# DOMAINS = [p.domains.keys() for p in config.projects]
# DOMAINS = [d.domain for d in p.domains for p in config.projects]
DOMAINS = []
print(type(config.projects[0].domains[0].domain))
print(type(config.projects[0].domains[0]))
for p in config.projects:
print(p.domains)
for d in p.domains:
Expand Down
6 changes: 3 additions & 3 deletions awa/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@

api_urls = (
[
path("api-auth", include('rest_framework.urls')),
path("api-auth", include("rest_framework.urls")),
],
"api"
"api",
)

# user_model = get_user_model()
Expand All @@ -89,7 +89,7 @@
# )

urlpatterns = [
path(f"{config.paths.admin}/", include(admin.site.urls),
path(f"{config.paths.admin}/", admin.site.urls),
path(
f"{config.paths.auth}/social/",
include("social_django.urls", namespace="awa.social"),
Expand Down
26 changes: 9 additions & 17 deletions awa/util/attr_dict.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from collections import UserList
# from collections import UserList

# cf. -- may reimplement but this interface works
# https://stackoverflow.com/questions/4984647/accessing-dict-keys-like-an-attribute
Expand All @@ -15,31 +15,31 @@ def __init__(self, iterator_arg=None, dict_class=None):
self.extend(iterator_arg)

def insert(self, i, v):
return super(AttrList, self).insert(i, self._dict_class._walk(v))
return super(AttrList, self).insert(i, self._dict_class._check(v))

def append(self, v):
return super(AttrList, self).append(self._dict_class._walk(v))
return super(AttrList, self).append(self._dict_class._check(v))

def extend(self, t):
return super(AttrList, self).extend([self._dict_class._walk(v) for v in t])
return super(AttrList, self).extend([self._dict_class._check(v) for v in t])

def __add__(self, t):
return super(AttrList, self).__add__([self._dict_class._walk(v) for v in t])
return super(AttrList, self).__add__([self._dict_class._check(v) for v in t])

def __iadd__(self, t):
return super(AttrList, self).__iadd__([self._dict_class._walk(v) for v in t])
return super(AttrList, self).__iadd__([self._dict_class._check(v) for v in t])

def __setitem__(self, i, v):
if isinstance(i, slice):
return super(AttrList, self).__setitem__(
i, [self._dict_class._walk(v1) for v1 in v]
i, [self._dict_class._check(v1) for v1 in v]
)
else:
return super(AttrList, self).__setitem__(i, self._dict_class._walk(v))
return super(AttrList, self).__setitem__(i, self._dict_class._check(v))

def __setslice__(self, i, j, t):
return super(AttrList, self).__setslice__(
i, j, [self._dict_class._walk(v) for v in t]
i, j, [self._dict_class._check(v) for v in t]
)


Expand All @@ -54,13 +54,6 @@ def __new__(cls, name, bases, dct):
class AttrDict(dict, metaclass=AttrDictCreator):
_list_class = AttrList

# _dict_class =

# { @property ### this causes problems
# @classmethod ### later on, maybe fix later
# def _dict_class(kls):
# return kls}

def __getitem__(self, key):
if is_internal(key):
return getattr(self, key)
Expand Down Expand Up @@ -103,7 +96,6 @@ def _walk(kls, node):
@classmethod
def _check(kls, val):
if type(val) is dict:

val, _ = kls._dict_class(val), True
elif type(val) is list:
val, _ = kls._list_class(val), True
Expand Down

0 comments on commit ebf9bbc

Please sign in to comment.