k.datatypes : module documentation

Part of kiwi

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'
Class Decimal Undocumented
Function GetLocaleInfo 0 Undocumented
Function GetLocaleInfo Undocumented
Class ValidationError Undocumented
Class ConverterRegistry No class docstring; 4/9 methods documented
Class BaseConverter Abstract converter used by all datatypes
Function lformat Like locale.format but with grouping enabled
Function get_localeconv Undocumented
Function filter_locale Removes the locale specific data from the value string.
Function format_price Formats a price according to the current locales monetary
Class _StringConverter Undocumented
Class _UnicodeConverter Undocumented
Class _IntConverter No class docstring; 2/2 methods documented
Class _LongConverter Undocumented
Class _BoolConverter No class docstring; 1/2 methods documented
Class _FloatConverter No class docstring; 2/2 methods documented
Class _DecimalConverter Undocumented
Class _BaseDateTimeConverter Abstract class for converting datatime objects to and from strings
Class _TimeConverter Undocumented
Class _DateTimeConverter Undocumented
Class _DateConverter Undocumented
Class _ObjectConverter Undocumented
Class _EnumConverter Undocumented
def GetLocaleInfo 0(value):
Undocumented
def GetLocaleInfo(value):
Undocumented
def lformat(format, value):
Like locale.format but with grouping enabled
def get_localeconv():
Undocumented
def 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()
Parametersvaluevalue to convert
monetaryif we should treat it as monetary data or not
Returnsthe value without locale specific data
def format_price(value, symbol=True, precision=None):
Formats a price according to the current locales monetary settings
Parametersvaluenumber
symbolwhether to include the currency symbol
API Documentation for Kiwi, generated by pydoctor at 2010-05-20 02:10:57.