Module s.l.defaults

Part of stoqlib.lib

Default values for applications
Function get_libc Returns an accessor to C library.
Function calculate_interval Get the interval type value for a certain INTERVALTYPE_* constant.
Function get_weekday_start Returns the dateutil.relativedelta.weekday based on the current locale.
Function payment_value_colorize A helper method for payment value columns used to set different
Function get_country_states Undocumented
Function _split_parts Undocumented
Function sort_sellable_code Undocumented
Function quantize Quantities a decimal according to the current settings.
def get_libc():
Returns an accessor to C library.
Returnsa ctypes.CDLL instance
def calculate_interval(interval_type, intervals):
Get the interval type value for a certain INTERVALTYPE_* constant. Intervals are useful modes to calculate payment duedates.
Parametersinterval_type
intervals
Returns
>>> calculate_interval(INTERVALTYPE_DAY, 5)
5
>>> calculate_interval(INTERVALTYPE_MONTH, 3)
90
>>> calculate_interval(INTERVALTYPE_YEAR, 10)
3650
def get_weekday_start():
Returns the dateutil.relativedelta.weekday based on the current locale.
Returnsa dateutil.realtivedelta.weekday instance
def payment_value_colorize(column_data):
A helper method for payment value columns used to set different colors for negative values
def get_country_states():
Undocumented
def _split_parts(a):
Undocumented
def sort_sellable_code(a, b):
Undocumented
def quantize(dec):

Quantities a decimal according to the current settings. if DECIMAL_PRECISION is set to two then everything but the last two decimals will be removed

>>> quantize(Decimal("10.123"))
Decimal('10.12')
>>> quantize(Decimal("10.678"))
Decimal('10.68')
API Documentation for Stoqlib, generated by pydoctor at 2009-07-14 16:00:32.