]> git.donarmstrong.com Git - lilypond.git/commit
This patch changes convertrules.py so that it uses a simple decorator function.
authorWilbert Berendsen <wbsoft@xs4all.nl>
Wed, 2 Jul 2008 16:36:13 +0000 (18:36 +0200)
committerGraham Percival <graham@percival-music.ca>
Sat, 5 Jul 2008 00:20:25 +0000 (17:20 -0700)
commit55494354ca340929aada3695a3b652e4fa313715
tree3772db53d5161213b92c18c6052440532ae9a722
parent4a339653432fd650eb6b27ade78bada70fe99e5b
This patch changes convertrules.py so that it uses a simple decorator function.

Instead of the double procedure (defining a function, and then calling
conversions.append()):

    def conv(str)
        # manipulate str
        return str

    conversions.append((version, conv, message))

when adding a new conversion rule, you can now simply write:

    @rule (version, message)
    def conv(str)
        # manipulate str
        return str

This makes more clear what parameters belong to the conversion function, and
you do not need to type the conversions.append(( )) command each time.

The decorator function does simply the conversions.append() so nothing changes
otherwise. The conversions list with the convertrules is just the same as
before. I fixed a few missing slashes in non-raw strings as well. No
translatable strings have been changed.

I verified (by diffing the output of repr() on both lists) that the
conversions list is the same as in the old situation.
python/convertrules.py