def process_ReceiverFile(self, store, rfile, data): language = rfile.receiver.user.language data['file'] = serialize_internalfile(rfile.internalfile) data['tip'] = serialize_rtip(store, rfile.receivertip, language) data['context'] = admin_serialize_context(store, rfile.internalfile.internaltip.context, language) data['receiver'] = admin_serialize_receiver(rfile.receiver, language) self.process_mail_creation(store, data)
def get_internalfiles_by_wbtip(self, store, wbtip_id): wbtip = store.find( models.WhistleblowerTip, models.WhistleblowerTip.id == unicode(wbtip_id)).one() ifiles = store.find( models.InternalFile, models.InternalFile.internaltip_id == unicode( wbtip.internaltip_id)) return [serialize_internalfile(ifil) for ifil in ifiles]
def process_event(self, store, rfile): context_desc = admin.context.admin_serialize_context( store, rfile.internalfile.internaltip.context, self.language) tip_desc = serialize_rtip(store, rfile.receivertip, self.language) file_desc = serialize_internalfile(rfile.internalfile) do_mail, receiver_desc = self.import_receiver(rfile.receiver) self.events.append( Event(type=self.template_type, trigger=self.trigger, node_info={}, receiver_info=receiver_desc, context_info=context_desc, tip_info=tip_desc, subevent_info=file_desc, do_mail=do_mail))
def process_event(self, store, rfile): context_desc = admin.context.admin_serialize_context(store, rfile.internalfile.internaltip.context, self.language) tip_desc = serialize_rtip(store, rfile.receivertip, self.language) file_desc = serialize_internalfile(rfile.internalfile) do_mail, receiver_desc = self.import_receiver(rfile.receiver) self.events.append(Event(type=self.template_type, trigger=self.trigger, node_info={}, receiver_info=receiver_desc, context_info=context_desc, tip_info=tip_desc, subevent_info=file_desc, do_mail=do_mail))
def serialize_content(store, cache, key, obj, language): obj_id = obj.id cache_key = key + obj_id + language if cache_key not in cache: if key == 'tip': cache_obj = serialize_rtip(store, obj, language) elif key == 'context': cache_obj = admin_serialize_context(store, obj, language) elif key == 'receiver': cache_obj = admin_serialize_receiver(obj, language) elif key == 'message': cache_obj = serialize_message(obj) elif key == 'comment': cache_obj = serialize_comment(obj) elif key == 'file': cache_obj = serialize_internalfile(obj) cache[cache_key] = cache_obj return copy.deepcopy(cache[cache_key])
def serialize_obj(self, store, key, obj, language): obj_id = obj.id cache_key = key + '-' + obj_id + '-' + language if cache_key not in self.cache: if key == 'tip': cache_obj = serialize_rtip(store, obj, language) elif key == 'context': cache_obj = admin_serialize_context(store, obj, language) elif key == 'receiver': cache_obj = admin_serialize_receiver(obj, language) elif key == 'message': cache_obj = serialize_message(obj) elif key == 'comment': cache_obj = serialize_comment(obj) elif key == 'file': cache_obj = serialize_internalfile(obj) self.cache[cache_key] = cache_obj return self.cache[cache_key]
def get_internalfiles_by_wbtip(self, store, wbtip_id): wbtip = store.find(models.WhistleblowerTip, models.WhistleblowerTip.id == unicode(wbtip_id)).one() ifiles = store.find(models.InternalFile, models.InternalFile.internaltip_id == unicode(wbtip.internaltip_id)) return [serialize_internalfile(ifil) for ifil in ifiles]