from decimal import Decimal
from zope.component import getUtility
from plone.registry.interfaces import IRegistry
from bda.plone.shop.interfaces import IShopArticleSettings
from bda.plone.shop.interfaces import IShopCartSettings
from bda.plone.shop.interfaces import IShopSettings
from bda.plone.shop.interfaces import IShopShippingSettings
from bda.plone.shop.interfaces import IShopTaxSettings
from bda.plone.shop.interfaces import INotificationTextSettings
from bda.plone.shop.interfaces import IPaymentTextSettings


def format_amount(val):
    val = val.quantize(Decimal('1.00'))
    if bool(val % 2):
        return str(val).replace('.', ',')
    return str(val.quantize(Decimal('1'))) + ',-'


def get_shop_settings():
    return getUtility(IRegistry).forInterface(IShopSettings)


def get_shop_tax_settings():
    return getUtility(IRegistry).forInterface(IShopTaxSettings)


def get_shop_article_settings():
    return getUtility(IRegistry).forInterface(IShopArticleSettings)


def get_shop_cart_settings():
    return getUtility(IRegistry).forInterface(IShopCartSettings)


def get_shop_shipping_settings():
    return getUtility(IRegistry).forInterface(IShopShippingSettings)


def get_shop_notification_settings():
    return getUtility(IRegistry).forInterface(INotificationTextSettings)


def get_shop_payment_settings():
    return getUtility(IRegistry).forInterface(IPaymentTextSettings)

@@ -1,12 +1,14 @@
+# 
 from decimal
@@ -518,37 +518,212 @@
 ngs%0A
-%0A%0Adef format_amount(val):%0A   
+from bda.plone.cart import ascur%0A%0A%0Adef format_amount(val):%0A    # User ascur method from bda.plone.cart to ensure shipping is displayed in%0A    # an international friendly manner%0A    return ascur(val)%0A    #
  val
@@ -758,16 +758,18 @@
 0'))%0A   
+ #
  if bool
@@ -782,16 +782,18 @@
  2):%0A   
+ #
      ret
@@ -822,24 +822,26 @@
 .', ',')%0A   
+ #
  return str(

use bda.plone.cart ascur method in order to avoid ',-' in shipping strings