return account
+ # Currency
+
+ def get_preferred_currency(self):
+ currency = self.get_argument("currency", None)
+
+ if currency in ("EUR", "USD"):
+ return currency
+
+ elif not currency:
+ if self.current_user:
+ country = self.current_user.country_code
+ else:
+ country = self.current_country_code
+
+ if country in ("US", "CA", "MX"):
+ return "USD"
+
+ return "EUR"
+
+ raise tornado.web.HTTPError(400, "Unsupported currency chosen: %s" % currency)
+
@property
def backend(self):
return self.application.backend