roskakori / cutplace

validate data stored in CSV, PRN, ODS or Excel files
http://cutplace.readthedocs.org/
GNU Lesser General Public License v3.0
18 stars 20 forks source link

Cleanup validation for declared field formats #82

Open roskakori opened 9 years ago

roskakori commented 9 years ago

Goal: parameters for fields.AbstractFieldFormat.__init__() are validated by there instead of mostly in interface.Cid.add_field_format().

The necessary changes are basically:

  1. Add optional location to fields.AbstractFieldFormat.__init__(); if None, set it to errors.create_caller_location().
  2. Move validation code for field declarations from interface.Cid.add_field_format() to fields.AbstractFieldFormat.__init__()
  3. Simplify reading of a field row by appending empty optional rows instead of repeated if item_count >= ... queries.