From: Oleg Broytman Date: Mon, 16 Mar 2015 00:07:42 +0000 (+0300) Subject: gen-sitemap: fix a bug: args.exclude can be None X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=3b607b20bbfbc5b8a2282d57b4c1f99f07f9d272;p=phdru.name%2Fphdru.name.git gen-sitemap: fix a bug: args.exclude can be None --- diff --git a/gen-sitemap.py b/gen-sitemap.py index aaff97a..333069f 100755 --- a/gen-sitemap.py +++ b/gen-sitemap.py @@ -12,10 +12,11 @@ parser.add_argument('root_dir', help='Root dicrectory') args = parser.parse_args() exclude = [] -for pat in args.exclude: - exclude.append(pat) - if not pat.endswith('/*'): - exclude.append(pat + '/*') +if args.exclude: + for pat in args.exclude: + exclude.append(pat) + if not pat.endswith('/*'): + exclude.append(pat + '/*') os.chdir(args.root_dir) fullpath = os.getcwd()