equal
deleted
inserted
replaced
537 if not (2 <= len(args) <= 3): |
537 if not (2 <= len(args) <= 3): |
538 # i18n: "word" is a keyword |
538 # i18n: "word" is a keyword |
539 raise error.ParseError(_("word expects two or three arguments, got %d") |
539 raise error.ParseError(_("word expects two or three arguments, got %d") |
540 % len(args)) |
540 % len(args)) |
541 |
541 |
542 num = int(stringify(args[0][0](context, mapping, args[0][1]))) |
542 try: |
|
543 num = int(stringify(args[0][0](context, mapping, args[0][1]))) |
|
544 except ValueError: |
|
545 # i18n: "word" is a keyword |
|
546 raise error.ParseError( |
|
547 _("Use strings like '3' for numbers passed to word function")) |
543 text = stringify(args[1][0](context, mapping, args[1][1])) |
548 text = stringify(args[1][0](context, mapping, args[1][1])) |
544 if len(args) == 3: |
549 if len(args) == 3: |
545 splitter = stringify(args[2][0](context, mapping, args[2][1])) |
550 splitter = stringify(args[2][0](context, mapping, args[2][1])) |
546 else: |
551 else: |
547 splitter = None |
552 splitter = None |