예제 #1
0
파일: _fields.py 프로젝트: yoshikichi/mrz
    def document_type(self) -> bool:
        """Return True if document type code is validated, False otherwise"""

        ok = False
        try:
            ok = bool(check.document_type(self._document_type, self))
        except ValueError:  # as error:
            # print("%s: %s", (error.args[0], error.args[1]))
            pass
        finally:
            return self._report("document type format", ok)
예제 #2
0
    def document_type(self, value: str):
        """Set document type code

        For TD1 and TD2, the first letter must be 'I', 'A' or 'C'. Optionally, can be used a
        second character. The second character shall be at discretion of issuing state.
        Note: 'V' shall not be used as 2nd char and 'C' shall not be used after 'A'. (TD1 and TD2)

        First letter of passports and other TD3 must be 'P'. Optionally, can be used a second
        character. The second character shall be at discretion of issuing state

        For visas (MRV-A and MRV-B), the first letter must be 'V'. Optionally, can be used a
        second character. The second character shall be at discretion of issuing state

        Case insensitive.

        """
        self._document_type = check.document_type(value, self) if not self.force \
            else check.field(value, 2, "document type")