Skip to content

Commit

Permalink
#82: Cleanup validation for declared field formats.
Browse files Browse the repository at this point in the history
Improved error message for broken field declarations in CIDs detected by the field format constructor, which now include the name of the field and the location in the CID.
  • Loading branch information
roskakori committed Jul 13, 2015
1 parent 373d35c commit b0aa453
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
12 changes: 8 additions & 4 deletions cutplace/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,10 +378,14 @@ def add_field_format_row(self, possibly_incomplete_items):
self._location.advance_cell()
field_rule = items[5].strip()
_log.debug("create field: %s(%r, %r, %r)", field_class.__name__, field_name, field_type, field_rule)
field_format = field_class.__new__(
field_class, field_name, field_is_allowed_to_be_empty, field_length, field_rule)
field_format.__init__(
field_name, field_is_allowed_to_be_empty, field_length, field_rule, self._data_format)
try:
field_format = field_class.__new__(
field_class, field_name, field_is_allowed_to_be_empty, field_length, field_rule)
field_format.__init__(
field_name, field_is_allowed_to_be_empty, field_length, field_rule, self._data_format)
except errors.InterfaceError as error:
error_location = error.location if error.location is not None else self._location
error.prepend_message('cannot declare field %s' % _compat.text_repr(field_name), error_location)

# Validate field length.
# TODO #82: Cleanup validation for declared field formats.
Expand Down
5 changes: 4 additions & 1 deletion docs/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@ Revision history
This chapter describes improvements compared to earlier versions of cutplace.


Version 0.8.6, 2015-07-06
Version 0.8.6, 2015-07-13
=========================

* Added command line option :option:`--gui` to open a graphical user
interface for validation (issue
`#77 <https://github.com/roskakori/cutplace/issues/77>`_).
* Improved error message for broken field declarations in CIDs detected by
the field format constructor, which now include the name of the field and
the location in the CID.
* Improved error message when attempting to use a 0 byte as item delimiter in
CID's for delimited data. (Python's :py:mod:`csv` module fails with a
:py:exc:`TypeError` because the low level implementation is based on C).
Expand Down

0 comments on commit b0aa453

Please sign in to comment.