def add_queue_entry(self, tag_obj, record_obj, label, comment, submitter, administrator=None, status="P"): #status pending if not self._tag_object_is_related(tag_obj, record_obj): raise Exception("Tag and object is not related") #TODO custom exception if not self._record_belongs_to_queue_software_release(record_obj): raise Exception("Record does not match queue software release") now = datetime.datetime.now() qte = GTQueueEntry() qte.queue = self.queue_obj qte.tag = tag_obj qte.record = record_obj qte.label = label qte.comment = comment qte.submitter = submitter qte.administrator = administrator qte.administration_time = now if (status=="P") or (status=="R") or (status=="I"): qte.status = status qte.save() elif (status=="O") or (status=="A"): print "STATUS O-A" with transaction.commit_on_success(): self.set_other_records_to_ignored(record_obj, label, status) qte.status = status qte.save() #TODO signal else: raise Exception("Unknown gt queue record status")
def create_queue_entries_from_gt(self, queue, administrator): now = datetime.datetime.now() with transaction.commit_on_success(): for gt_record in queue.last_gt.globaltagrecord_set.all(): qte = GTQueueEntry() qte.queue = queue qte.tag = gt_record.tag qte.record = gt_record.record qte.label = gt_record.label #ASK PFN qte.comment = "Automaticaly created comment for original entries" #ASK maybe global tag entires should have qte.status = 'O' qte.submitter = administrator qte.administrator = administrator qte.administration_time = now qte.save()
def create_queue_entries_from_gt(self, queue, administrator): now = datetime.datetime.now() with transaction.commit_on_success(): for gt_record in queue.last_gt.globaltagrecord_set.all(): qte = GTQueueEntry() qte.queue = queue qte.tag = gt_record.tag qte.record = gt_record.record qte.label =gt_record.label #ASK PFN qte.comment = "Automaticaly created comment for original entries" #ASK maybe global tag entires should have qte.status = 'O' qte.submitter = administrator qte.administrator = administrator qte.administration_time = now qte.save() #todo detect if success
def create_children(self, administrator): if self.has_children(): raise Exception("Queue allready fully created. Can not additionally insert children") #TODO custom exception now = datetime.datetime.now() with transaction.commit_on_success(): for gt_record in self.queue_obj.last_gt.globaltagrecord_set.all(): qte = GTQueueEntry() qte.queue = self.queue_obj qte.tag = gt_record.tag qte.record = gt_record.record qte.label = gt_record.label qte.comment = "Automaticaly created comment for original entries" qte.status = 'O' qte.submitter = administrator qte.administrator = administrator qte.administration_time = now qte.save()
def create_children(self, administrator): if self.has_children(): raise Exception( "Queue allready fully created. Can not additionally insert children" ) #TODO custom exception now = datetime.datetime.now() with transaction.commit_on_success(): for gt_record in self.queue_obj.last_gt.globaltagrecord_set.all(): qte = GTQueueEntry() qte.queue = self.queue_obj qte.tag = gt_record.tag qte.record = gt_record.record qte.label = gt_record.label qte.comment = "Automaticaly created comment for original entries" qte.status = 'O' qte.submitter = administrator qte.administrator = administrator qte.administration_time = now qte.save()
def add_queue_entry(self, tag_obj, record_obj, label, comment, submitter, administrator=None, status="P"): #status pending if not self._tag_object_is_related(tag_obj, record_obj): raise Exception( "Tag and object is not related") #TODO custom exception if not self._record_belongs_to_queue_software_release(record_obj): raise Exception("Record does not match queue software release") now = datetime.datetime.now() qte = GTQueueEntry() qte.queue = self.queue_obj qte.tag = tag_obj qte.record = record_obj qte.label = label qte.comment = comment qte.submitter = submitter qte.administrator = administrator qte.administration_time = now if (status == "P") or (status == "R") or (status == "I"): qte.status = status qte.save() elif (status == "O") or (status == "A"): print "STATUS O-A" with transaction.commit_on_success(): self.set_other_records_to_ignored(record_obj, label, status) qte.status = status qte.save() #TODO signal else: raise Exception("Unknown gt queue record status")