Created
March 26, 2012 11:00
-
-
Save AeroNotix/2204443 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def set_locale_decorator(func): | |
| import locale | |
| if locale.getdefaultlocale()[0] == 'en_GB': | |
| def curr_conv(string): | |
| major_num = ''.join(string.split(',')) | |
| return major_num | |
| delim = ',' | |
| elif locale.getdefaultlocale()[0] == 'de_DE': | |
| def curr_conv(string): | |
| major_num = string.replace('.', '').replace(',', '.') | |
| return major_num | |
| delim = ';' | |
| else: | |
| print "Locale settings not supported" | |
| print "press Q to quit, or any other key to continue" | |
| print "with default settings and hope that you don't" | |
| print "end up with a crazy output." | |
| key_in = raw_input("Enter your choice:") | |
| if key_in.lower() == 'q': | |
| quit() | |
| else: | |
| def curr_conv(string): | |
| major_num = ''.join(string.split(',')) | |
| return major_num | |
| delim = ',' | |
| return func | |
| @set_locale_decorator | |
| def whatevers(x, y): | |
| print x, y |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment