From eb2cadd20735c7f52817d5d82209c513a7563887 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sun, 31 Jan 2010 18:29:23 -0600 Subject: Fix reporead choking on empty values Signed-off-by: Dan McGee --- scripts/reporead.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'scripts') diff --git a/scripts/reporead.py b/scripts/reporead.py index c0d43d1..2d1460c 100755 --- a/scripts/reporead.py +++ b/scripts/reporead.py @@ -93,13 +93,15 @@ class Pkg(object): val['license'] = [] for x in val.keys(): if x in squash: - if len(val[x]) == 0: + if val[x] == None or len(val[x]) == 0: logger.warning("Package %s has no %s" % (selfdict['name'],x)) - selfdict[x] = ', '.join(val[x]) - # make sure we don't have elements larger than the db char - # fields - if len(selfdict[x]) > 255: - selfdict[x] = selfdict[x][:254] + selfdict[x] = None + else: + selfdict[x] = ', '.join(val[x]) + # make sure we don't have elements larger than the db char + # fields + if len(selfdict[x]) > 255: + selfdict[x] = selfdict[x][:254] elif x == 'base': selfdict[x] = val[x][0] elif x == 'force': @@ -395,3 +397,4 @@ if __name__ == '__main__': logger.level = INFO sys.exit(main()) +# vim: set ts=4 sw=4 et: -- cgit v1.2.3-24-g4f1b