jenkins-bot has submitted this change and it was merged.
Change subject: Fix isbn.py -to13 operation when ISBN are already in this format ......................................................................
Fix isbn.py -to13 operation when ISBN are already in this format
Currently, the isbn.py -to13 operation doesn't support objects already in ISBN 13 format.
To fix this issue, a toISBN13 method is added to the ISBN13 class.
Ideally this wouldn't be required but this allows to simplify code.
Bug: T138911 Change-Id: I755c8623486ed29a273891e17025b4b468273005 --- M scripts/isbn.py 1 file changed, 5 insertions(+), 1 deletion(-)
Approvals: Eranroz: Looks good to me, but someone else must approve Dalba: Looks good to me, approved jenkins-bot: Verified
diff --git a/scripts/isbn.py b/scripts/isbn.py index b96676c..7e83f9d 100755 --- a/scripts/isbn.py +++ b/scripts/isbn.py @@ -1466,7 +1466,11 @@ except InvalidIsbnException: # don't change return isbn - i13 = getIsbn(isbn).toISBN13() + i1x = getIsbn(isbn) + if not isinstance(i1x, ISBN13): + i13 = i1x.toISBN13() + else: + i13 = i1x return i13.code