Skip to content

Commit

Permalink
.first() returns None if no result, doesnt throw noresultexception
Browse files Browse the repository at this point in the history
  • Loading branch information
Galithil committed May 8, 2017
1 parent 99a5296 commit 3d7a779
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions LIMS2DB/classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -536,10 +536,10 @@ def get_initial_qc(self, sample):
inner join sample sa on sa.processid=asm.processid \
where sa.processid = {sapid} and pr.typeid in ({tid}) and art2.isoriginal=True and art.name like '%CaliperGX%{sname}' \
order by pr.daterun desc;".format(sapid=sample.processid, tid=','.join(pc_cg.CALIPER.keys()), sname=sample.name)
try:
caliper_file = self.session.query(GlsFile).from_statement(text(query)).first()
caliper_file = self.session.query(GlsFile).from_statement(text(query)).first()
if caliper_file:
self.obj['samples'][sample.name]['initial_qc']['caliper_image'] = "sftp://{host}/home/glsftp/{uri}".format(host=self.host, uri=caliper_file.contenturi)
except NoResultFound:
else:
self.log.info("Did not find an initial QC Caliper for sample {}".format(sample.name))

def get_library_preps(self, sample):
Expand Down

0 comments on commit 3d7a779

Please sign in to comment.