Permalink
Browse files

added simpler filter syntax

for instance instead of
"filter": ["ISO", "=", "FRA"]
you can now use
"filter": { "ISO": "FRA" }
  • Loading branch information...
1 parent c04ef85 commit a75c97f779b9326653930e78df4c93c2433f860a @gka gka committed Jul 28, 2012
Showing with 4 additions and 0 deletions.
  1. +4 −0 kartograph/filter.py
View
@@ -16,6 +16,10 @@ def filter_record(filt, record):
res = False
for sfilt in filt['or']:
res = res or filter_record(sfilt, record)
+ else:
+ res = True
+ for key in filt:
+ res = res and filter_record([key, '=', filt[key]], record)
elif isinstance(filt, list):
res = filter_single(filt, record)
return res

0 comments on commit a75c97f

Please sign in to comment.