I am able to save some information with the code you gave but when i try 
read from that file i get back *None *values: Am i missing something???

*CONTROLLER FOR READING THE FILE:*
def viewInfo():
    db = DAL('sqlite:memory')
    db.define_table('Clients',
                         Field('Name'),
                         Field('Surname'))
    backfile = os.path.join(request.folder, 'Client_Bookings_Backup.csv')
    db.Clients.import_from_csv_file(open(backfile))
    grid = SQLFORM.grid(db.Clients, args=[db.Clients], editable=False, 
deletable=False, user_signature=False)
    return locals()
 Regards

Mostwanted

On Tuesday, October 23, 2018 at 10:11:55 PM UTC+2, Dave S wrote:
>
>
>
> On Tuesday, October 23, 2018 at 11:44:41 AM UTC-7, mostwanted wrote:
>>
>> I have a folder in my desktop that contains a CSV file that backs up 
>> information everytime something gets saved into the database. What i wanna 
>> know is how can I instead have this folder and CSV backup file saved in the 
>> app somewhere so that even if i relocate the application or take it online 
>> i don't have redefine the folder path or have it missing because the path 
>> was not defined correctly.
>>
>>
> Something like the change below:
>  
>
>> *CONTROLLER SAVING TO THE EXTERNAL CSV FILE:*
>> def index():
>>     form=SQLFORM(db.Customer)
>>     if form.accepts(request.vars, session):
>>         customer=db(db.Customer).select(db.Customer.ALL)
>>
>  
>
>>         backfile = os.path.join(request.folder, '
>> Client_Bookings_Backup.csv')
>>         customer.export_to_csv_file(open(backfile, 'wb'))
>>
>  
>
>>
>>         response.flash = T("CLIENT BOOKED")
>>     elif form.errors:
>>         response.flash = T("BOOKING FAILED! Please observe the form!")
>>     return locals()
>>
>> Regards:
>>
>> Mostwanted
>>
>
> Good luck!
>
> Dave "somewhat wanted"
> /dps
>  
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to