示例#1
0
    def load_from_data_object(self, notification_timer):
        """
        Hydrate ourselves from a passed in notification_timer
        """

        self.name = notification_timer.name  # pylint: disable=attribute-defined-outside-init
        self.callback_at = notification_timer.callback_at
        self.class_name = notification_timer.class_name
        self.context = DictField.to_json(notification_timer.context)
        self.is_active = notification_timer.is_active
        self.periodicity_min = notification_timer.periodicity_min
        self.executed_at = notification_timer.executed_at
        self.err_msg = notification_timer.err_msg
        self.results = DictField.to_json(notification_timer.results)
示例#2
0
    def load_from_data_object(self, notification_timer):
        """
        Hydrate ourselves from a passed in notification_timer
        """

        self.name = notification_timer.name  # pylint: disable=attribute-defined-outside-init
        self.callback_at = notification_timer.callback_at
        self.class_name = notification_timer.class_name
        self.context = DictField.to_json(notification_timer.context)
        self.is_active = notification_timer.is_active
        self.periodicity_min = notification_timer.periodicity_min
        self.executed_at = notification_timer.executed_at
        self.err_msg = notification_timer.err_msg
        self.results = DictField.to_json(notification_timer.results)
示例#3
0
    def load_from_data_object(self, msg_type):
        """
        Hydrate ourselves from a passed in user_msg
        """

        self.name = msg_type.name  # pylint: disable=attribute-defined-outside-init
        self.renderer = msg_type.renderer
        self.renderer_context = DictField.to_json(msg_type.renderer_context)
示例#4
0
    def load_from_data_object(self, msg_type):
        """
        Hydrate ourselves from a passed in user_msg
        """

        self.name = msg_type.name  # pylint: disable=attribute-defined-outside-init
        self.renderer = msg_type.renderer
        self.renderer_context = DictField.to_json(msg_type.renderer_context)
示例#5
0
    def load_from_data_object(self, user_msg):
        """
        Hydrate ourselves from a passed in user_msg
        """

        self.id = user_msg.id  # pylint: disable=attribute-defined-outside-init
        self.user_id = user_msg.user_id
        self.msg = SQLNotificationMessage.from_data_object(user_msg.msg)
        self.read_at = user_msg.read_at
        self.user_context = DictField.to_json(user_msg.user_context)
示例#6
0
    def load_from_data_object(self, msg):
        """
        Hydrate ourselves from a data object, note that we
        do not set the created/modified timestamps as that
        is auto-generated
        """

        msg.validate()

        self.id = msg.id  # pylint: disable=attribute-defined-outside-init
        self.namespace = msg.namespace
        self.msg_type = SQLNotificationType.from_data_object(msg.msg_type)
        self.from_user_id = msg.from_user_id
        self.deliver_no_earlier_than = msg.deliver_no_earlier_than
        self.expires_at = msg.expires_at
        self.expires_secs_after_read = msg.expires_secs_after_read
        self.payload = DictField.to_json(msg.payload)
        self.resolve_links = DictField.to_json(msg.resolve_links)
        self.object_id = msg.object_id
示例#7
0
    def load_from_data_object(self, user_msg):
        """
        Hydrate ourselves from a passed in user_msg
        """

        self.id = user_msg.id  # pylint: disable=attribute-defined-outside-init
        self.user_id = user_msg.user_id
        self.msg = SQLNotificationMessage.from_data_object(user_msg.msg)
        self.read_at = user_msg.read_at
        self.user_context = DictField.to_json(user_msg.user_context)
示例#8
0
    def load_from_data_object(self, msg):
        """
        Hydrate ourselves from a data object, note that we
        do not set the created/modified timestamps as that
        is auto-generated
        """

        msg.validate()

        self.id = msg.id  # pylint: disable=attribute-defined-outside-init
        self.namespace = msg.namespace
        self.msg_type = SQLNotificationType.from_data_object(msg.msg_type)
        self.from_user_id = msg.from_user_id
        self.deliver_no_earlier_than = msg.deliver_no_earlier_than
        self.expires_at = msg.expires_at
        self.expires_secs_after_read = msg.expires_secs_after_read
        self.payload = DictField.to_json(msg.payload)
        self.resolve_links = DictField.to_json(msg.resolve_links)
        self.object_id = msg.object_id
 def to_native(self, obj):
     """
     to json format
     """
     return DictField.to_json(obj)
示例#10
0
 def to_representation(self, obj):
     """
     to json format
     """
     return DictField.to_json(obj)
示例#11
0
 def to_native(self, obj):
     """
     to json format
     """
     return DictField.to_json(obj)