# make a list of inactive avatars
inactive_avatars = []
for account in self.categories["account"].values():
- inactive_avatars += [
- (self.contents[x]) for x in account.getlist("avatars")
- ]
+ for avatar in account.get("avatars"):
+ try:
+ inactive_avatars.append(self.contents[avatar])
+ except KeyError:
+ pending_loglines.append((
+ "Missing avatar \"%s\", possible data corruption" %
+ avatar, 6))
for user in self.userlist:
if user.avatar in inactive_avatars:
inactive_avatars.remove(user.avatar)
def list_avatar_names(self):
"""List names of assigned avatars."""
- return [
- universe.contents[avatar].get(
- "name"
- ) for avatar in self.account.getlist("avatars")
- ]
+ avatars = []
+ for avatar in self.account.get("avatars"):
+ try:
+ avatars.append(universe.contents[avatar].get("name"))
+ except KeyError:
+ log("Missing avatar \"%s\", possible data corruption." %
+ avatar, 6)
+ return avatars
def broadcast(message, add_prompt=True):