Ńň
Tˇ Lc           @   s3   d  d k  l Z d  d k l Z d d d  Z d S(   i˙˙˙˙(   t   settings(   t	   mark_safei    t    c         C   s  t  i o t  i o | } t |  t  o! | o | o t t |    St |   d j  o
 d } n d } t |   } | d d j o | d } n d | j o. | i d  \ } }	 | o |	 |  }	 qá n | d } }	 | o |	 d | t	 |	  }	 n |	 o | |	 }	 n | or d }
 xR t
 | d d d   D]7 \ } } | o | | o |
 | 7}
 n |
 | 7}
 q@W|
 d d d  } n | | |	 S(	   sr  
    Gets a number (as a number or string), and returns it as a string,
    using formats definied as arguments:

    * decimal_sep: Decimal separator symbol (for example ".")
    * decimal_pos: Number of decimal positions
    * grouping: Number of digits in every group limited by thousand separator
    * thousand_sep: Thousand separator symbol (for example ",")

    i    t   -R   i   t   .t   0Ni˙˙˙˙(   R    t   USE_L10Nt   USE_THOUSAND_SEPARATORt
   isinstancet   intR   t   unicodet   floatt   splitt   lent	   enumerate(   t   numbert   decimal_sept   decimal_post   groupingt   thousand_sept   use_groupingt   signt
   str_numbert   int_partt   dec_partt   int_part_gdt   cntt   digit(    (    sC   /usr/local/lib/python2.6/dist-packages/django/utils/numberformat.pyt   format   s8    
 
  N(   t   django.confR    t   django.utils.safestringR   R   (    (    (    sC   /usr/local/lib/python2.6/dist-packages/django/utils/numberformat.pyt   <module>   s   