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