This is a bug that has been fixed in trunk. Sorry about it.

Massimo

On Jun 19, 1:55 am, Wei Wang <ww9riv...@gmail.com> wrote:
> Greetings!
>
> I have a simple form, which takes in a CSV file name and upload the file for
> import to database.
>
> This is the code to import uploaded data:
>
>     if form.accepts(request.vars, session):
>         response.flash = 'Form accepted'
>         db.import_from_csv_file(request.vars.csvfile.file)
>
> In the database db, I have a table "unit":
>
> db.define_table('unit',
>         Field('org', db.org, requires=IS_NOT_EMPTY()),
>         Field('type', type='integer', label=T('Unit Type'),
> requires=IS_NOT_EMPTY(),),
>         Field('name', type='string', label=T('Unit Name'),
> requires=IS_NOT_EMPTY(),))
>
> The problem is: When I upload the file below, I get all NULL's for the
> unit.type field.
>
> TABLE unit
> unit.org,unit.type,unit.name
> 1,1,"Unit 10"
> 1,1,"Unit 12"
> 1,1,"Unit 13"
> 1,1,"Unit 14"
> 1,1,"Unit 15"
> 1,1,"Unit 16"
> 1,1,"Unit 17"
> 1,1,"Unit 18"
> 1,1,"Unit 7"
> 1,1,"Unit 8"
> 1,1,"Unit 9"
> 1,2,"Unit 10"
> 1,2,"Unit 19"
> 1,3,"Unit 13"
> 1,3,"Unit 14"
> 1,3,"Unit 15"
> 1,3,"Unit 17"
> 1,3,"Unit 18"
> 1,3,"Unit 19"
> 1,3,"Unit 4"
> 1,3,"Unit 6"
> 1,3,"Unit 8"
> 1,3,"Unit 9"
> 2,1,"Unit 22"
> 2,1,"Unit 23"
> 2,2,"Unit 20"
> 2,3,"Unit 21"
> 3,1,"Unit 32"
> 3,1,"Unit 34"
> 3,3,"Unit 31"
> 3,3,"Unit 33"
> 4,1,"Unit 37"
> 4,1,"Unit 42"
> 4,2,"Unit 39"
> 4,2,"Unit 44"
> 4,2,"Unit 47"
> 4,3,"Unit 45"
> 4,3,"Unit 48"
>
> END
>
> Help is much appreciated.

Reply via email to