diff options
author | Dan McGee <dan@archlinux.org> | 2010-01-31 18:29:23 -0600 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2010-01-31 18:29:23 -0600 |
commit | eb2cadd20735c7f52817d5d82209c513a7563887 (patch) | |
tree | 4afc02cb100da8d3524fd65469d3c0c9b60e3342 /scripts | |
parent | 0cce15c7109cfb7bab976d35ca68961ddb9ad644 (diff) |
Fix reporead choking on empty values
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/reporead.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/scripts/reporead.py b/scripts/reporead.py index c0d43d1e..2d1460ca 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: |