def fromString(cls, string, start, ignoreErrors=False): """Decode dbf field definition from the string data. Arguments: string: a string, dbf definition is decoded from. length of the string must be 32 bytes. start: position in the database file. ignoreErrors: initial error processing mode for the new field (boolean) """ assert len(string) == 32 _length = ord(string[16]) return cls(utils.unzfill(string)[:11], _length, ord(string[17]), start, start + _length, ignoreErrors=ignoreErrors)
def fromString(cls, string, start, encoding=None): """Decode dbf field definition from the string data. Arguments: string: a string, dbf definition is decoded from. length of the string must be 32 bytes. start: position in the database file. """ assert len(string) == 32 _length = ord(string[16]) name = utils.unzfill(string)[:11] if encoding: name = unicode(name, encoding) else: name = unicode(name) return cls(name, _length, ord(string[17]), start, start + _length)