def dumps(self, aggregated):
     activities = pickle.dumps(aggregated.activities)
     model_instance = self.model(activity_id=long_t(
         aggregated.serialization_id),
                                 activities=activities,
                                 group=aggregated.group,
                                 created_at=aggregated.created_at,
                                 updated_at=aggregated.updated_at)
     return model_instance
Example #2
0
 def dumps(self, activity):
     self.check_type(activity)
     return self.model(activity_id=long_t(activity.serialization_id),
                       actor=activity.actor_id,
                       time=activity.time,
                       verb=activity.verb.id,
                       object=activity.object_id,
                       target=activity.target_id,
                       extra_context=pickle.dumps(activity.extra_context))
Example #3
0
 def validate(self, value):
     val = super(VarInt, self).validate(value)
     if val is None:
         return
     try:
         return long_t(val)
     except (TypeError, ValueError):
         raise ValidationError(
             "{} can't be converted to integer value".format(value))
 def dumps(self, aggregated):
     activities = pickle.dumps(aggregated.activities)
     model_instance = self.model(
         activity_id=long_t(aggregated.serialization_id),
         activities=activities,
         group=aggregated.group,
         created_at=aggregated.created_at,
         updated_at=aggregated.updated_at
     )
     return model_instance
 def dumps(self, activity):
     self.check_type(activity)
     return self.model(
         activity_id=long_t(activity.serialization_id),
         actor=activity.actor_id,
         time=activity.time,
         verb=activity.verb.id,
         object=activity.object_id,
         target=activity.target_id,
         extra_context=pickle.dumps(activity.extra_context)
     )