[web2py] Re: web2py

2015-09-26 Thread 黄祥
please take a look at this link
http://web2py.com/books/default/chapter/29/04/the-core#request

best regards,
stifan

-- 
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.


[web2py] Re: web2py dry

2015-09-26 Thread T.R.Rajkumar
Thank you for the reply. I do not know how to code it in a module. Example 
code would be of great help. Is there any example in book? 

-- 
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.


Re: [Bulk] [web2py] Re: web2py dry

2015-09-26 Thread 'Diogene Laerce' via web2py-users
Hi,

Le 26/09/2015 12:58, T.R.Rajkumar a écrit :
> Thank you for the reply. I do not know how to code it in a module.
> Example code would be of great help. Is there any example in book?

You can use this for example :

http://www.ibiblio.org/g2swap/byteofpython/read/making-modules.html

And place it in the site-packages or modules/ folder in your application.

Good luck,

-- 
“One original thought is worth a thousand mindless quotings.”
“Le vrai n'est pas plus sûr que le probable.”

  Diogene Laerce


-- 
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.


signature.asc
Description: OpenPGP digital signature


[web2py] session less connections

2015-09-26 Thread icodk
I have many sensors that reports periodically to a web2py application.
The sensors do not need to log in, they just POST a json string to specific 
controller function, get a few bytes in response and close the connection. 
However each time a sensor connect, a session file is generated. This 
create a lot of useless files. Otherwise the site has a standard user 
interface that requires login from users.
Is it possible  to avoid the session creation just for that controller 
function or do I need to make a session less app that update the same 
database ?

-- 
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.


[web2py] Re: How to download (zip) file with jQuery ajax?

2015-09-26 Thread Phillip
I get the same result with the posted function, albeit your nuances 
appreciated.

To be thorough, I'll repost the updated function.

def download_that():

import zipfile

import cStringIO

import contenttype as c

vars = request.vars

tempfile = cStringIO.StringIO()

temparchive = zipfile.ZipFile(tempfile, 'w', zipfile.ZIP_DEFLATED)



fileIDs = vars.values()

try:

for file_id in fileIDs:

file = db.files[file_id].file

fileLoc = db.files.file.retrieve_file_properties(file)['path'] 
+ '/' + file

temparchive.writestr(db.files[file_id].file_name, open(fileLoc, 
'rb').read())



finally:

temparchive.close() #writes 

response.headers['Content-Disposition'] = 
'attachment;filename=files.zip'

response.headers['Content-Type'] = 'application/zip'

rtn = tempfile.getvalue()

tempfile.close()

return rtn

-- 
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.


Re: [web2py] session less connections

2015-09-26 Thread Vinicius Assef
Read about `sessions.forget()`[1]

[1] http://web2py.com/books/default/chapter/29/04/the-core#session 



—
Vinicius.




> On 26 Sep 2015, at 17:47, icodk  wrote:
> 
> I have many sensors that reports periodically to a web2py application.
> The sensors do not need to log in, they just POST a json string to specific 
> controller function, get a few bytes in response and close the connection. 
> However each time a sensor connect, a session file is generated. This create 
> a lot of useless files. Otherwise the site has a standard user interface that 
> requires login from users.
> Is it possible  to avoid the session creation just for that controller 
> function or do I need to make a session less app that update the same 
> database ?
> 
> 
> -- 
> 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 
> .

-- 
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.


[web2py] Using as_list() as a performance boost

2015-09-26 Thread Vinicius Assef
Hi everyone.

I'm developping a function that wil be called through ajax and it accesses the 
DB, but I need it to be as fast as possible.

Would I expect the `as_list()` method be faster than the normal `select()`?

—
Vinicius.




-- 
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.