

def encodeValue(self, value):
    'Return string containing encoded ``value``.'
    _rv = ('%*.*f' % (self.length, self.decimalCount, value))
    if (len(_rv) > self.length):
        _ppos = _rv.find('.')
        if (0 <= _ppos <= self.length):
            _rv = _rv[:self.length]
        else:
            raise ValueError(('[%s] Numeric overflow: %s (field width: %i)' % (self.name, _rv, self.length)))
    return _rv

dataset/ETHPy150Open kennethreitz/tablib/tablib/packages/dbfpy3/fields.py DbfNumericFieldDef.encodeValue/original