Improved warning message when brand is not proper. #232

This commit is contained in:
John Evans 2014-05-10 15:58:57 -04:00
commit bf65a00f28
2 changed files with 7 additions and 5 deletions

View file

@ -1241,8 +1241,10 @@ class FileTypeBox(Jp2kBox):
def _validate(self, writing=False): def _validate(self, writing=False):
"""Validate the box before writing to file.""" """Validate the box before writing to file."""
if self.brand not in ['jp2 ', 'jpx ']: if self.brand not in ['jp2 ', 'jpx ']:
msg = "The file type brand must be either 'jp2 ' or 'jpx '." msg = "The file type brand was '{0}'. "
self._dispatch_validation_error(msg, writing=writing) msg += "It should be either 'jp2 ' or 'jpx '."
self._dispatch_validation_error(msg.format(self.brand),
writing=writing)
valid_cls = ['jp2 ', 'jpx ', 'jpxb'] valid_cls = ['jp2 ', 'jpx ', 'jpxb']
for item in self.compatibility_list: for item in self.compatibility_list:
if item not in valid_cls: if item not in valid_cls: