Exports fail for @dplatten

Issue #123 resolved
Ed McDonagh created an issue

Exports are failing on the line

e = e.filter(**{f[filt].name + '__' + f[filt].lookup_type : filterdict[filt]})

Doesn't matter which filters, as long as there are some.

Comments (17)

  1. Ed McDonagh reporter

    Testing shows that there seems to be a list coming through, which then trips up filterdict[filt]

    There may also be some empty values.

    Proposed fix from @dplatten

        for filt in f:
            if filt in filterdict and filterdict[filt]:
                if (filterdict[filt])[0] <> '':
                    e = e.filter(**{f[filt].name + '__' + f[filt].lookup_type : (filterdict[filt])[0]})
    
  2. Ed McDonagh reporter

    Fix proposed by @dplatten for export failures on his install. Checks for empty first values and assumes a list rather than a string. Refs #123.

    → <<cset fe30a0cc831b>>

  3. Ed McDonagh reporter

    If filterdict[filt] is a unicode/string then using the [0] will of course just get the first character. Hence test for string, then if not assume list. Refs #123.

    → <<cset 38706cd169b3>>

  4. Ed McDonagh reporter

    Merge message should have said (forgot --no-ff): Additional code added to filter code to check for lists. Tested with CT xlsx on Ubuntu and @dplatten's Windows install, tested csv mg, fluoro and CT on Ubuntu and csv nhsbsp on Ubuntu. Fixes #123.

  5. Log in to comment