Set initial value of internal caches to None

This commit is contained in:
thec0sm0s
2020-05-15 22:41:41 +05:30
parent 44e3423cd9
commit b1abfb5c2d

View File

@@ -57,8 +57,8 @@ class User(DiscordModelsBase):
self.premium_type = self._payload.get("premium_type") self.premium_type = self._payload.get("premium_type")
# Few properties which are intended to be cached. # Few properties which are intended to be cached.
self._guilds = dict() # Mapping of guild ID to flask_discord.models.Guild(...). self._guilds = None # Mapping of guild ID to flask_discord.models.Guild(...).
self.connections = list() # List of flask_discord.models.UserConnection(...). self.connections = None # List of flask_discord.models.UserConnection(...).
@property @property
def guilds(self): def guilds(self):
@@ -66,7 +66,10 @@ class User(DiscordModelsBase):
API call for guilds is requested so it might be an empty dict. API call for guilds is requested so it might be an empty dict.
""" """
try:
return list(self._guilds.values()) return list(self._guilds.values())
except AttributeError:
pass
@guilds.setter @guilds.setter
def guilds(self, value): def guilds(self, value):