Skip to content

Template argument parsing #6

@phit

Description

@phit

Awesome tool! Just ran into a minor issue with the argument parsing clashing with jinja2 templates, it may be worthwhile to use some existing library to handle all the edgecase for this or the ability to pass templates as files.

Anything using = and , breaks immediately due to the logic in parse_and_set, quoting is also rather cumbersome.

For now I added a limit of 1 to the split here https://github.com/cdaller/multi_anonymizer/blob/main/multi_anonymizer.py#L127
and am avoiding commas by writing

'./file.csv:(type=city,column=15,template={% if __original_value__ == "_____" or __original_value__ == "Dummy" or __original_value__ == "_" %}{{ __original_value__ }}{% else %}{{ __value__ }}{% endif %})'

instead of

'./file.csv:(type=city,column=15,template={% if __original_value__ in ["_____", "Dummy", "_"] %}{{ __original_value__ }}{% else %}{{ __value__ }}{% endif %})'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions