while toread: field_type = self.model._meta.fields[x].__class__.__name__ field_name = self.model._meta.fields[x].name if field_type == "CharField" or field_type == "TextField": offset = unpack("i", toread[0:4])[0] str = "" newoffset = offset while self.stringblock[newoffset:newoffset+1] != "\x00": str += self.stringblock[newoffset:newoffset+1] newoffset += 1 row[field_name] = str toread = toread[4:] elif field_type == "FloatField": row[field_name] = unpack("f", toread[0:4])[0] toread = toread[4:] elif field_type == "SmallIntegerField": row[field_name] = unpack("H", toread[0:2])[0] toread = toread[2:] elif field_type == "PositiveSmallIntegerField": row[field_name] = unpack("h", toread[0:2])[0] toread = toread[2:] elif field_type == "PositiveIntegerField": row[field_name] = unpack("i", toread[0:4])[0] toread = toread[4:] elif field_type == "ForeignKey": row[field_name] = else: row[field_name] = unpack("I", toread[0:4])[0] toread = toread[4:] x += 1 if self.debug: print "%s (%s): %s" % (field_name, field_type, row[field_name]) return row