def format_money(value): symbol = [ currency['symbol'] for currency in get_currencies() if currency['code'] == str(value.currency) ][0] return '{} {}'.format(symbol.encode('utf-8'), value.amount)
def handle(self, *args, **kwargs): with tempfile.NamedTemporaryFile(dir='bluebottle', suffix='.py') as temp: for app, file in self.fixtures: with open('bluebottle/{}/fixtures/{}'.format(app, file)) as fixture_file: strings = [ fixture['fields']['name'].encode('utf-8') for fixture in json.load(fixture_file) ] for string in strings: temp.write('gettext("{}")\n'.format(string)) for currency in get_currencies(): temp.write('gettext("{}")\n'.format(currency['name'])) temp.flush() return super(Command, self).handle(*args, **kwargs)
def format_money(value): symbol = [currency['symbol'] for currency in get_currencies() if currency['code'] == str(value.currency)][0] return '{} {}'.format(symbol.encode('utf-8'), value.amount)