def __repr__(self): props = {name: getattr(self, name) for name in self.__slots__} props['date'] = self.date.strftime('%Y-%m-%d %H:%M:%S %z') return trim(""" <private message from {sender} to {recipient}, dated {date}, with subject {subject} > """).replace('\n', '').format_map(props)
def __str__(self): """Print the private message's details in BBcode.""" props = {name: getattr(self, name) for name in self.__slots__} props['date'] = self.date.strftime('%c') return trim(""" [quote="{sender}, in a message to {recipient}, at {date}"] [b]{subject}[/b] {message} [/quote] """).format_map(props)