kelvinn/capparselib

Allow users to choice the CAP mappings

Opened this issue · 2 comments

Thanks for taking the time to write this library and making it open source @kelvinn!

My only issue the library are the proprietary CAP mappings. My code requires standard CAP 1.2 mappings so I've had to convert the keys afterwards.

Would you consider allowing the users of the library to use their own mappings and/or provide some optional mappings?

I suggest moving CAP_MAPPINGS to a new python file mappings.py. I would suggest adding another mapping there, CAP_MAPPINGS_1_2.

By adding an optional parameter to the __init__ method you can, with very little changes, allow the user to choice the mappings:
__init__(self, raw_cap_xml=None, recover=False, mapping=mappings.CAP_MAPPINGS)

Would you like my to provide a pull request?

Cheers,
Helgi

Hi @helgiborg - 100% this makes sense. I'd love to see your PR!

Hi @kelvinn, I added the PR for this.