| Paste number 72966: | currency chooser |
| Pasted by: | khinester |
| When: | 6 months, 14 hours ago |
| Share: | Tweet this! | http://paste.lisp.org/+1KAU |
| Channel: | None |
| Paste contents: |
import locale
namespace = {}
currency = self.get_property('currency')
price = self.get_property('price')
currencies = root.get_currency(currency)
for x in [d for d in currencies if d['is_selected'] == True]:
if x['id'] == 'EUR':
locale.setlocale(locale.LC_ALL,('fr', 'ascii'))
price = locale.format('%.2f', price, True)
format = '%s %s' % (price, x['sign'])
else:
locale.setlocale(locale.LC_ALL,('en', 'ascii'))
price = locale.format('%.2f', price, True)
format = '%s %s' % (x['sign'], price)
namespace['price'] = formatThis paste has no annotations.