Package kiwi :: Module datatypes
[frames | no frames]

Module kiwi.datatypes

Data type converters with locale and currency support.

Provides routines for converting data to and from strings. Simple example:
>>> from kiwi.datatypes import converter
>>> converter.from_string(int, '1,234')
'1234'

>>> converter.from_string(float, '1,234')
'1234.0'

>>> converter.to_string(currency, currency('10.5'))
'$10.50'

Classes
BaseConverter Abstract converter used by all datatypes
ConverterRegistry  

Exceptions
ValidationError  

Function Summary
  _(m)
kiwi
  filter_locale(value, monetary)
Removes the locale specific data from the value string.
  get_localeconv()
  lformat(format, value)
Like locale.format but with grouping enabled

Function Details

_(m)

kiwi

filter_locale(value, monetary=False)

Removes the locale specific data from the value string. Currently we only remove the thousands separator and convert the decimal point. The returned value of this function can safely be passed to float()
Parameters:
value - value to convert
monetary - if we should treat it as monetary data or not
Returns:
the value without locale specific data

lformat(format, value)

Like locale.format but with grouping enabled

Generated by Epydoc 2.1 on Tue Feb 6 10:53:33 2007 http://epydoc.sf.net