mirror of
git://git.yoctoproject.org/layerindex-web.git
synced 2025-07-19 12:49:01 +02:00
update_classic_status: tweak single-object queries
.first() returns None if the query is empty, so we can simplify this. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
This commit is contained in:
parent
19e40eff5a
commit
3daa2349ae
|
@ -59,10 +59,8 @@ def main():
|
|||
|
||||
logger.setLevel(options.loglevel)
|
||||
|
||||
res = list(LayerItem.objects.filter(name=options.layer)[:1])
|
||||
if res:
|
||||
layer = res[0]
|
||||
else:
|
||||
layer = LayerItem.objects.filter(name=options.layer).first()
|
||||
if not layer:
|
||||
logger.error('Specified layer %s does not exist in database' % options.layer)
|
||||
sys.exit(1)
|
||||
|
||||
|
@ -73,11 +71,10 @@ def main():
|
|||
|
||||
updateobj = None
|
||||
if options.update:
|
||||
updateobj = Update.objects.filter(id=int(options.update))
|
||||
updateobj = Update.objects.filter(id=int(options.update)).first()
|
||||
if not updateobj:
|
||||
logger.error("Specified update id %s does not exist in database" % options.update)
|
||||
sys.exit(1)
|
||||
updateobj = updateobj.first()
|
||||
|
||||
if options.skip:
|
||||
skiplist = options.skip.split(',')
|
||||
|
|
Loading…
Reference in New Issue
Block a user