Leonel,
Thank you for the quick answer, I'll try to implement this. I assume this
will not touch the other form handling in components.
Richard D
On Thursday, November 6, 2014 7:34:36 PM UTC+1, Richard D wrote:
>
> Dear all,
>
> I am making a csv import function but encounter a strange difference
> between the function in a html page and a LOAD.
> The import in the HTML page works fine, the in the LOAD not.
>
> In the controller I have:
>
> current_rec=get_current_rec(session.sif.id, session.dim.id)
> if get_lower_recursion(current_rec):
> formcsv = FORM(str(T('Import from csv file')) + " ",
> INPUT(_type='file', _name='csvfile'),
> INPUT(_type='submit', _value=T('import')))
>
> if formcsv.process().accepted:
> print "check:"
> print get_lower_recursion(current_rec)
> db(db.staging_import_entities.id>0).delete()
>
> db.staging_import_entities.import_from_csv_file(formcsv.vars.csvfile.file)
>
> response.flash = T('data uploaded')
> for e in db(db.staging_import_entities.id>0).select():
> create_entity_from_staging(session.com.id, session.sif.id,
> session.dim.id ,
> e.enti_name,
> description=e.description,
> latitude=None, longitude=None,
> valid_from=None, valid_till=None)
> db.commit()
> elif formcsv.errors:
> response.flash="Entity selection has errors"
> else:
> formcsv = T('No recursion exists for the entities! Please create
> alower recursion.')
>
> return locals()
>
>
> In the view I have:
>
> The new page variant:
> <li>{{=A(T("Import entities from csv file"),
> _href=URL('import','import_entities.html'), _target='new') }}</li>
>
> The load variant
> <li>{{=A(T("Import entities from csv file, load"),
> _href=URL('import','import_entities.load'), ajax=True,
> cid='internal_add_data_div') }}</li>
>
> It looks like the formcsv.process().accepted is working differently, why?
> Or is something else broken?
>
> Richard D (D for distinguishing to the other Richard ;) )
>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.