def _resolve_data(self, data): data['content'] = remove_all_non_printables(data['content']) utc = parse_timestring(data.get('created', '')) data['created'] = utc_to_local(utc) if data.get('type', None) == 'sys': return self._resolve_sys_data(data) return self._resolve_user_data(data)
def _resolve_data(self, data): utc = parse_timestring(data.get('created', '')) data['time'] = utc_to_local(utc) data['content'] = remove_all_non_printables(data['content']) #data['role'] = data.get('role', post_roles[0]['key']) or post_roles[0]['key'] #data['role_text'] = data.get('role_text', anonymous_nick) or anonymous_nick icon = None if self.theme: data['theme'] = self.theme.key icon_index = data.get('icon', '') if isinstance(icon_index, int): icon, icolor = self.theme.get_icon_tuple(icon_index) if icon: data['icon'] = icon data['icon_color'] = icolor elif 'icon' in data: # if no icon was parsed, make sure to remove it and force # the widget to load the default icon del data['icon']