Add a message with an optional type.

def add_message(self, text, type=None):
        """Add a message with an optional type."""
        key = self._msg_key
        self.setdefault(key, [])
        self[key].append(message(type, text))
        self.save()