445 def build(cls, decl, defn): |
445 def build(cls, decl, defn): |
446 """Parse an alias declaration and definition into an alias object""" |
446 """Parse an alias declaration and definition into an alias object""" |
447 repl = efmt = None |
447 repl = efmt = None |
448 name, args, err = cls._builddecl(decl) |
448 name, args, err = cls._builddecl(decl) |
449 if err: |
449 if err: |
450 efmt = _('failed to parse the declaration of %(section)s ' |
450 efmt = _('bad declaration of %(section)s "%(name)s": %(error)s') |
451 '"%(name)s": %(error)s') |
|
452 else: |
451 else: |
453 try: |
452 try: |
454 repl = cls._builddefn(defn, args) |
453 repl = cls._builddefn(defn, args) |
455 except error.ParseError as inst: |
454 except error.ParseError as inst: |
456 err = parseerrordetail(inst) |
455 err = parseerrordetail(inst) |
457 efmt = _('failed to parse the definition of %(section)s ' |
456 efmt = _('bad definition of %(section)s "%(name)s": %(error)s') |
458 '"%(name)s": %(error)s') |
|
459 if err: |
457 if err: |
460 err = efmt % {'section': cls._section, 'name': name, 'error': err} |
458 err = efmt % {'section': cls._section, 'name': name, 'error': err} |
461 return alias(name, args, err, repl) |
459 return alias(name, args, err, repl) |
462 |
460 |
463 @classmethod |
461 @classmethod |