import cPickle, os
def put_on_disk(file_name, data):
uploadfolder=os.path.join(request.folder, 'uploads')
fn = os.path.join(uploadfolder, file_name)
out_file = open(fn, 'w')
cPickle.dump(data, out_file)
out_file.close()
def get_from_disk(file_name):
uploadfolder=os.path.join(request.folder, 'uploads')
fn = os.path.join(uploadfolder, file_name)
in_file = open(fn, 'r')
data = cPickle.load(in_file)
in_file .close()
return data
--------------------------------
save data on disk, add user.id to file name
четверг, 20 февраля 2020 г., 0:49:11 UTC+3 пользователь mostwanted написал:
>
> I'm trying to use SQLFORM.factory to search by date but its failing, it is
> somehow possible to that & i'm missing something?? If so where can i
> rectify my code to give me results?
>
> *MY FUNCTION*
> def search():
> form=SQLFORM.factory(Field('SEARCH', 'date')
> if form.accepts(request):
> tokens=form.vars.SEARCH.split()
> query=reduce(lambda a,b:a&b, [db.birthdays.contains(k) for k in
> tokens])
> people=db(query).select(orderby=db.birthdays.Person)
> else:
> people=[]
> return locals()
>
> Regards;
>
> Mostwanted
>
--
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].
To view this discussion on the web visit
https://groups.google.com/d/msgid/web2py/24aed2dc-75c6-49e3-b6b5-b8b1cf5603bf%40googlegroups.com.