# Path: shopkit/currency/simple/settings.py
# CURRENCY_FORMATTING = getattr(settings, 'SHOPKIT_CURRENCY_FORMATTING')


import logging
from shopkit.currency.simple.settings import CURRENCY_FORMATTING
# Copyright (C) 2010-2011 Mathijs de Bruin <mathijs@mathijsfietst.nl>
#
# This file is part of django-shopkit.
#
# django-shopkit is free software; you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

logger = logging.getLogger(__name__)



def format_price(amount):
    """ Format the given float-like object in the current locale. """
    try:
        float(amount)
    except ValueError:
        logger.warn('Attempting to format an empty price, failing softly by returning None.')
        return None


# Path: shopkit/currency/simple/settings.py
# CURRENCY_FORMATTING = getattr(settings, 'SHOPKIT_CURRENCY_FORMATTING')


# Path: shopkit/currency/simple/utils.py
import logging
from shopkit.currency.simple.settings import CURRENCY_FORMATTING

# Copyright (C) 2010-2011 Mathijs de Bruin <mathijs@mathijsfietst.nl>
#
# This file is part of django-shopkit.
#
# django-shopkit is free software; you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

logger = logging.getLogger(__name__)



def format_price(amount):
    """ Format the given float-like object in the current locale. """
    try:
        float(amount)
    except ValueError:
        logger.warn('Attempting to format an empty price, failing softly by returning None.')
        return None


    return CURRENCY_FORMATTING % amount