mirror of
git://git.yoctoproject.org/layerindex-web.git
synced 2025-07-19 20:59: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)
|
logger.setLevel(options.loglevel)
|
||||||
|
|
||||||
res = list(LayerItem.objects.filter(name=options.layer)[:1])
|
layer = LayerItem.objects.filter(name=options.layer).first()
|
||||||
if res:
|
if not layer:
|
||||||
layer = res[0]
|
|
||||||
else:
|
|
||||||
logger.error('Specified layer %s does not exist in database' % options.layer)
|
logger.error('Specified layer %s does not exist in database' % options.layer)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
@ -73,11 +71,10 @@ def main():
|
||||||
|
|
||||||
updateobj = None
|
updateobj = None
|
||||||
if options.update:
|
if options.update:
|
||||||
updateobj = Update.objects.filter(id=int(options.update))
|
updateobj = Update.objects.filter(id=int(options.update)).first()
|
||||||
if not updateobj:
|
if not updateobj:
|
||||||
logger.error("Specified update id %s does not exist in database" % options.update)
|
logger.error("Specified update id %s does not exist in database" % options.update)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
updateobj = updateobj.first()
|
|
||||||
|
|
||||||
if options.skip:
|
if options.skip:
|
||||||
skiplist = options.skip.split(',')
|
skiplist = options.skip.split(',')
|
||||||
|
|
Loading…
Reference in New Issue
Block a user