[web2py] Database access without DAL but with connection pool

2014-03-19 Thread tech . uz
Dear Sirs,


I understand it's possible to use databases without DAL.
For example function in controller:

def values():
client = pymongo.MongoClient('localhost', 27017)
db = client.mybase
mytable = db[mytable]
res = mytable.find()
.

return dict()

And of course it works.
But is it fast to connect/disconnect every time in function? What's about 
connection pool?
I consider connection pool could increase access to database. 

1. Actually I would like to ask how to access to database without DAL but 
at maximum speed?
2. Do I need connection pool for fast database access? (I think, yes.)
3. How could I build custom connection pool for database access without 
DAL? Or any solution to re-use connections to database server? Any examples?



Andrey A.

-- 
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] I am trying to build a page to display video files list with thumbnail like youtube do.

2014-03-19 Thread Ravi

Hi ! I am  new to web2py and python  and trying to build a page to display 
video files list with  thumbnail like youtube do. I am using Expose to 
display files and folder in a browser .its working fine. but how to 
add/display thumbnail with each video files contain in a directory. what 
should i need to add to get my desired display.
this is my code..

from gluon.tools import Expose
def myfolder():
return dict(files=Expose('/home/ravi/Videos'))

help is appreciated. Thanx in advance.

-- 
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] Python Performance Issue, Part 2

2014-03-19 Thread Michele Comitini
if threads=0 does not work use threads=1 and make mod_wsgi happy.  If
you remove threads it defaults to 15.

2014-03-19 4:34 GMT+01:00 horridohobbyist horrido.hobb...@gmail.com:
 threads=0 is no good–Apache restart upchucks on this.

 BTW, I haven't experimented with the threads value. Might this also improve
 performance (with respect to GIL)?

 Also, I was wondering. Is the processes= solution related to whether you
 are using the prefork MPM or the worker MPM? I know that Apache is
 normally compiled to use the prefork MPM.


 On Tuesday, 18 March 2014 16:26:24 UTC-4, Michele Comitini wrote:

  WSGIDaemonProcess hello user=www-data group=www-data threads=5

 with web2py try the following instead:
 WSGIDaemonProcess hello user=www-data group=www-data processes=number
 of cores + 1 threads=(0 or 1)

 If it's faster, then the GIL must be the cause.  flask by default has
 much less features active (session for instance)



 2014-03-18 21:04 GMT+01:00 horridohobbyist horrido...@gmail.com:
  I took the shipping code that I ran in Flask (without Apache) and
  adapted it
  to run under Apache as a Flask app. That way, I'm comparing apples to
  apples. I'm comparing the performance of the shipping code between Flask
  and
  web2py.
 
  Below, I've included the 'default' file from Apache2/sites-available for
  Flask.
 
  Basically, the code in Flask executes 10x faster than the same code in
  web2py. So my question is:  if Apache is at fault for the web2py app's
  slow
  performance, why doesn't Apache hurt the Flask app's performance? (This
  doesn't seem to be related to GIL or WSGI.)
 
 
  VirtualHost *:80
ServerName 10.211.55.7
WSGIDaemonProcess hello user=www-data group=www-data threads=5
WSGIScriptAlias / /home/richard/welcome/hello.wsgi
 
Directory /home/richard/welcome
  Order Allow,Deny
  Allow from all
/Directory
  /VirtualHost
 
  --
  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+un...@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.

-- 
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] Python Performance Issue, Part 2

2014-03-19 Thread Tim Richardson
Did you explicitly set the number of threads as well? By default you get 15 
threads per process. The documentation implies that this is a hard limit, 
but I'm not sure.
Maybe you have simply found a bottleneck in threads. Did you also try 
increasing the number of threads instead of adding more processes? 
Multi-threaded apache is supposed to be faster than multi-process apache 
under real load (i.e. multiple users) because starting processes is 
expensive in time and memory.
So any conclusion that you need more processes is dubious, I think. I can't 
recall how many simultaneous users your benchmarking is testing. 
Bear in mind that the fastest servers, the greenlet or co-operative async 
servers, are not only limited to one process, but even to one thread. 











On Wednesday, 19 March 2014 14:25:47 UTC+11, horridohobbyist wrote:

 I shall do that. Thanks.

 With the knowledge about processes=, I've tuned my actual Linux server 
 to eliminate the 10x slowdown. As it turns out, for my 2.4GHz quad-core 
 Xeon with 4GB RAM, processes=2 works best. I found that any other value 
 (3, 4, 5) gave very inconsistent results–sometimes I would get 1x (the 
 ideal) and sometimes I would get 10x. Very bizarre.

 processes=2 is counter-intuitive. After all, I have 4 cores. Why 
 shouldn't processes=4 be good?

 Anyway, not only is the shipping code fast, but I find that my overall 
 web2py app feels a lot snappier. Is it just my imagination?

 If processes=2 is boosting the speed of Python in general, then you 
 would expect all of web2py to benefit. So maybe it's not my imagination.

 Anyway, the takeaway, I think, is that you must tune the Apache 
 configuration for the particular server hardware that you have. The default 
 processes=1 is not good enough.


 On Tuesday, 18 March 2014 22:37:58 UTC-4, Massimo Di Pierro wrote:

 Thank you for all your tests. You should write a summary of your results 
 with recommendations for Apache users.

 On Tuesday, 18 March 2014 19:44:29 UTC-5, horridohobbyist wrote:

 Done. With processes=3, the 10x discrepancy is eliminated! (And this is 
 in a Linux VM configured for 1 CPU.)


 On Tuesday, 18 March 2014 16:26:24 UTC-4, Michele Comitini wrote:

  WSGIDaemonProcess hello user=www-data group=www-data threads=5 

 with web2py try the following instead: 
 WSGIDaemonProcess hello user=www-data group=www-data processes=number 
 of cores + 1 threads=(0 or 1) 

 If it's faster, then the GIL must be the cause.  flask by default has 
 much less features active (session for instance) 



 2014-03-18 21:04 GMT+01:00 horridohobbyist horrido...@gmail.com: 
  I took the shipping code that I ran in Flask (without Apache) and 
 adapted it 
  to run under Apache as a Flask app. That way, I'm comparing apples to 
  apples. I'm comparing the performance of the shipping code between 
 Flask and 
  web2py. 
  
  Below, I've included the 'default' file from Apache2/sites-available 
 for 
  Flask. 
  
  Basically, the code in Flask executes 10x faster than the same code 
 in 
  web2py. So my question is:  if Apache is at fault for the web2py 
 app's slow 
  performance, why doesn't Apache hurt the Flask app's performance? 
 (This 
  doesn't seem to be related to GIL or WSGI.) 
  
  
  VirtualHost *:80 
ServerName 10.211.55.7 
WSGIDaemonProcess hello user=www-data group=www-data threads=5 
WSGIScriptAlias / /home/richard/welcome/hello.wsgi 
  
Directory /home/richard/welcome 
  Order Allow,Deny 
  Allow from all 
/Directory 
  /VirtualHost 
  
  -- 
  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+un...@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.


Re: [web2py] Python Performance Issue, Part 2

2014-03-19 Thread Michele Comitini
 Multi-threaded apache is supposed to be faster than multi-process apache 
 under real load (i.e. multiple users) because starting processes is expensive 
 in time and memory.


IMHO under linux the difference is really negligible.  Popularity of
threads rose in mid '90 because a very popular OS was not able to do
forks properly. Java developed threading API, instead of a
multiprocess and message passing API as a consequence of that flaw.
Today there is no need of threading in general concurrent programming,
unless one is stuck in Java.



2014-03-19 10:24 GMT+01:00 Tim Richardson t...@growthpath.com.au:
 Did you explicitly set the number of threads as well? By default you get 15
 threads per process. The documentation implies that this is a hard limit,
 but I'm not sure.
 Maybe you have simply found a bottleneck in threads. Did you also try
 increasing the number of threads instead of adding more processes?
 Multi-threaded apache is supposed to be faster than multi-process apache
 under real load (i.e. multiple users) because starting processes is
 expensive in time and memory.
 So any conclusion that you need more processes is dubious, I think. I can't
 recall how many simultaneous users your benchmarking is testing.
 Bear in mind that the fastest servers, the greenlet or co-operative async
 servers, are not only limited to one process, but even to one thread.











 On Wednesday, 19 March 2014 14:25:47 UTC+11, horridohobbyist wrote:

 I shall do that. Thanks.

 With the knowledge about processes=, I've tuned my actual Linux server
 to eliminate the 10x slowdown. As it turns out, for my 2.4GHz quad-core Xeon
 with 4GB RAM, processes=2 works best. I found that any other value (3, 4,
 5) gave very inconsistent results–sometimes I would get 1x (the ideal) and
 sometimes I would get 10x. Very bizarre.

 processes=2 is counter-intuitive. After all, I have 4 cores. Why
 shouldn't processes=4 be good?

 Anyway, not only is the shipping code fast, but I find that my overall
 web2py app feels a lot snappier. Is it just my imagination?

 If processes=2 is boosting the speed of Python in general, then you
 would expect all of web2py to benefit. So maybe it's not my imagination.

 Anyway, the takeaway, I think, is that you must tune the Apache
 configuration for the particular server hardware that you have. The default
 processes=1 is not good enough.


 On Tuesday, 18 March 2014 22:37:58 UTC-4, Massimo Di Pierro wrote:

 Thank you for all your tests. You should write a summary of your results
 with recommendations for Apache users.

 On Tuesday, 18 March 2014 19:44:29 UTC-5, horridohobbyist wrote:

 Done. With processes=3, the 10x discrepancy is eliminated! (And this is
 in a Linux VM configured for 1 CPU.)


 On Tuesday, 18 March 2014 16:26:24 UTC-4, Michele Comitini wrote:

  WSGIDaemonProcess hello user=www-data group=www-data threads=5

 with web2py try the following instead:
 WSGIDaemonProcess hello user=www-data group=www-data processes=number
 of cores + 1 threads=(0 or 1)

 If it's faster, then the GIL must be the cause.  flask by default has
 much less features active (session for instance)



 2014-03-18 21:04 GMT+01:00 horridohobbyist horrido...@gmail.com:
  I took the shipping code that I ran in Flask (without Apache) and
  adapted it
  to run under Apache as a Flask app. That way, I'm comparing apples to
  apples. I'm comparing the performance of the shipping code between
  Flask and
  web2py.
 
  Below, I've included the 'default' file from Apache2/sites-available
  for
  Flask.
 
  Basically, the code in Flask executes 10x faster than the same code
  in
  web2py. So my question is:  if Apache is at fault for the web2py
  app's slow
  performance, why doesn't Apache hurt the Flask app's performance?
  (This
  doesn't seem to be related to GIL or WSGI.)
 
 
  VirtualHost *:80
ServerName 10.211.55.7
WSGIDaemonProcess hello user=www-data group=www-data threads=5
WSGIScriptAlias / /home/richard/welcome/hello.wsgi
 
Directory /home/richard/welcome
  Order Allow,Deny
  Allow from all
/Directory
  /VirtualHost
 
  --
  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+un...@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 

Re: [web2py] pysimplesoap help

2014-03-19 Thread piero crisci
Hi mariano i still got some problem
I solved the problem with the basic authentication but i still have some 
problem on calling webservice.
The webservice infact need a first call for the db connection ('init' )
After this call you can call the other services.
I made this code :
 
from pysimplesoap.client import SoapClient
from pysimplesoap.client import SoapClient, SimpleXMLElement
location_wsdl =  
*http://docway.demo.3di.it*/3diws/services/eXtraWayhttp://docway.demo.3di.it/3diws/services/eXtraWay

wsdl =  
*http://docway.demo.3di.it/*/3diws/services/eXtraWay?wsdlhttp://10.55.38.247:8080/3diws/services/eXtraWay?wsdl

namespace_wsdl =  
*http://docway.demo.3di.it/*http://www.google.com/url?q=http%3A%2F%2Fdocway.demo.3di.it%2F3diws%2Fservices%2FeXtraWay%3Fwsdlsa=Dsntz=1usg=AFQjCNFAe47af7Nlfx1k8KJR8x-hsRTOAg
3diws/services/eXtraWay http://10.55.38.247:8080/3diws/services/eXtraWay
import base64
username='admin'
password=''
auth = base64.b64encode('%s:%s' % (username, password))
client = SoapClient(location = location_wsdl, 
wsdl=wsdl,*sessions=True,*namespace=namespace_wsdl, 
http_headers={'Authorization': Basic %s % 
auth},username=username,password=password)
client['AuthHeaderElement'] = {'Authorization': Basic %s % auth}

client.send('init',xml=xml_init)
client.send('executeQuery',xml=xml_execute_query)
When i call the 'executeQuery' i got as response that the connection is not 
established. The connection should be established with the 'Init' call . 
I got the same problem with SOAPUI but i managed to solve the problem 
activating the option Maintain HTTP Session
Even putting sessions = True is not solving the problem
Thank for help 
Piero

Il giorno martedì 18 marzo 2014 07:26:35 UTC+1, Mariano Reingart ha scritto:

 Hi piero:

 The first choice to connect to a webservice that requires username  
 password (add_credentials), you will httplib2 installed:

 https://code.google.com/p/httplib2

 Then you could do:

 client = SoapClient(location = location_wsdl,sessions=True,
 username='admin',password='xx')

 Also, assuming your webservice supports basic auth, you could pass the 
 Authentication http header directly (it shouldn't need to install external 
 library):

 import base64
 auth = base64.b64encode('%s:%s' % (username, password)).replace('\n', '')

 client = SoapClient(location = location_wsdl, sessions=True, 
 http_headers={'Authorization': Basic %s % auth})

 Let me know if this solves your issue,

 Best regards


 Mariano Reingart
 http://www.sistemasagiles.com.ar
 http://reingart.blogspot.com


 On Mon, Mar 17, 2014 at 6:02 PM, piero crisci 
 piero@gmail.comjavascript:
  wrote:

 Hello i am trying to connect to this wsdl: 
 http://docway.demo.3di.it/3diws/services/eXtraWay?wsdl 
 It requires http basic authentication  and i am using pysimplesoap 1.10 
 and i tried this configuration:

 from pysimplesoap.client import SoapClient
 location_wsdl = http://docway.demo.3di.it/3diws/services;
 wsdl = http://docway.demo.3di.it/3diws/services/eXtraWay?wsdl;
 client = SoapClient(location = 
 location_wsdl,sessions=True,http_headers={'username': 'admin', 'password': 
 ''},username='admin',password='xx')

 I got this error
 Traceback (most recent call last):
   File stdin, line 1, in module
   File build\bdist.win32\egg\pysimplesoap\client.py, line 133, in 
 __init__
   File build\bdist.win32\egg\pysimplesoap\client.py, line 469, in 
 wsdl_parse
   File build\bdist.win32\egg\pysimplesoap\helpers.py, line 71, in fetch
   File build\bdist.win32\egg\pysimplesoap\transport.py, line 121, in 
 request
   File C:\python27\lib\urllib2.py, line 406, in open
 response = meth(req, response)
   File C:\python27\lib\urllib2.py, line 519, in http_response
 'http', request, response, code, msg, hdrs)
   File C:\python27\lib\urllib2.py, line 444, in error
 return self._call_chain(*args)
   File C:\python27\lib\urllib2.py, line 378, in _call_chain
 result = func(*args)
   File C:\python27\lib\urllib2.py, line 527, in http_error_default
 raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
 urllib2.HTTPError: HTTP Error 401: Unauthorized

 It seems like the basic authenitcation is not supported. am I wrong?
 How i need to change the wsdl call? And how i can use a session to send 
 different call?
 Thx for help!
  
 -- 
 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+un...@googlegroups.com javascript:.
 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)

Re: [web2py] Python Performance Issue, Part 2

2014-03-19 Thread horridohobbyist
Yes, processes=3 and threads=1.

I tried processes=1 and threads=3, and performance was still 10x bad. 
So I guess that answers my question:  the threads parameter is not helpful.


On Wednesday, 19 March 2014 05:24:01 UTC-4, Tim Richardson wrote:

 Did you explicitly set the number of threads as well? By default you get 
 15 threads per process. The documentation implies that this is a hard 
 limit, but I'm not sure.
 Maybe you have simply found a bottleneck in threads. Did you also try 
 increasing the number of threads instead of adding more processes? 
 Multi-threaded apache is supposed to be faster than multi-process apache 
 under real load (i.e. multiple users) because starting (and switching) 
 processes is expensive in time and memory.*
 So any conclusion that you need more processes is dubious, I think. I 
 can't recall how many simultaneous users your benchmarking is testing. 
 Bear in mind that the fastest servers, the greenlet or co-operative async 
 servers, are not only limited to one process, but even to one thread. 

 http://nichol.as/benchmark-of-python-web-servers










 On Wednesday, 19 March 2014 14:25:47 UTC+11, horridohobbyist wrote:

 I shall do that. Thanks.

 With the knowledge about processes=, I've tuned my actual Linux server 
 to eliminate the 10x slowdown. As it turns out, for my 2.4GHz quad-core 
 Xeon with 4GB RAM, processes=2 works best. I found that any other value 
 (3, 4, 5) gave very inconsistent results–sometimes I would get 1x (the 
 ideal) and sometimes I would get 10x. Very bizarre.

 processes=2 is counter-intuitive. After all, I have 4 cores. Why 
 shouldn't processes=4 be good?

 Anyway, not only is the shipping code fast, but I find that my overall 
 web2py app feels a lot snappier. Is it just my imagination?

 If processes=2 is boosting the speed of Python in general, then you 
 would expect all of web2py to benefit. So maybe it's not my imagination.

 Anyway, the takeaway, I think, is that you must tune the Apache 
 configuration for the particular server hardware that you have. The default 
 processes=1 is not good enough.


 On Tuesday, 18 March 2014 22:37:58 UTC-4, Massimo Di Pierro wrote:

 Thank you for all your tests. You should write a summary of your results 
 with recommendations for Apache users.

 On Tuesday, 18 March 2014 19:44:29 UTC-5, horridohobbyist wrote:

 Done. With processes=3, the 10x discrepancy is eliminated! (And this is 
 in a Linux VM configured for 1 CPU.)


 On Tuesday, 18 March 2014 16:26:24 UTC-4, Michele Comitini wrote:

  WSGIDaemonProcess hello user=www-data group=www-data threads=5 

 with web2py try the following instead: 
 WSGIDaemonProcess hello user=www-data group=www-data processes=number 
 of cores + 1 threads=(0 or 1) 

 If it's faster, then the GIL must be the cause.  flask by default has 
 much less features active (session for instance) 



 2014-03-18 21:04 GMT+01:00 horridohobbyist horrido...@gmail.com: 
  I took the shipping code that I ran in Flask (without Apache) and 
 adapted it 
  to run under Apache as a Flask app. That way, I'm comparing apples 
 to 
  apples. I'm comparing the performance of the shipping code between 
 Flask and 
  web2py. 
  
  Below, I've included the 'default' file from Apache2/sites-available 
 for 
  Flask. 
  
  Basically, the code in Flask executes 10x faster than the same code 
 in 
  web2py. So my question is:  if Apache is at fault for the web2py 
 app's slow 
  performance, why doesn't Apache hurt the Flask app's performance? 
 (This 
  doesn't seem to be related to GIL or WSGI.) 
  
  
  VirtualHost *:80 
ServerName 10.211.55.7 
WSGIDaemonProcess hello user=www-data group=www-data threads=5 
WSGIScriptAlias / /home/richard/welcome/hello.wsgi 
  
Directory /home/richard/welcome 
  Order Allow,Deny 
  Allow from all 
/Directory 
  /VirtualHost 
  
  -- 
  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+un...@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.


Re: [web2py] 504 Gateway Time-out

2014-03-19 Thread Johann Spies
I have had that.

As I understand it, this happens when it takes longer to get the answer
from uwsgi than was specified in the parameter

uwsgi_read_timeout

Try increasing the timeout or do something to speedup your query or both...

Regards
Johann




On 19 March 2014 00:53, António Ramos ramstei...@gmail.com wrote:

 i have this error on linux with sqlite as my database sometimes when i
 save a record

 504 Gateway Time-out

 --
 nginx


 Did anyone had this error before?


 Thank you

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




-- 
Because experiencing your loyal love is better than life itself,
my lips will praise you.  (Psalm 63:3)

-- 
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] Python Performance Issue, Part 2

2014-03-19 Thread horridohobbyist
In 2007, I wrote my first web application using Smalltalk/Seaside. I chose 
Seaside because it was a very easy-to-learn, easy-to-program, 
easy-to-deploy, highly productive, self-contained all-in-one web framework. 
(It still is, today.) Unfortunately, web2py hadn't been born yet, but 
clearly the two frameworks had similar goals. (Born in 2002, Seaside has 5 
years over web2py.)

I deployed the Seaside app under Apache on the same hardware that I'm using 
today for web2py. Yes, my 2.4GHz quad-core Xeon Dell server with 4GB RAM is 
over 7 years old!!

Recently, I switched over to web2py because I had heard so many good things 
about it. I can now say that web2py is far superior to Seaside. It's even 
more easy-to-learn and easy-to-program; it's even more productive. And 
Seaside was pretty darn good in this respect!

I believe web2py is the best available web framework in the world today, 
regardless of language (ie, Java, Ruby, PHP, etc.). I am 100% in agreement 
with its philosophy and goals.

Please, keep up the good work!


On Wednesday, 19 March 2014 07:27:54 UTC-4, horridohobbyist wrote:

 Yes, processes=3 and threads=1.

 I tried processes=1 and threads=3, and performance was still 10x bad. 
 So I guess that answers my question:  the threads parameter is not helpful.


 On Wednesday, 19 March 2014 05:24:01 UTC-4, Tim Richardson wrote:

 Did you explicitly set the number of threads as well? By default you get 
 15 threads per process. The documentation implies that this is a hard 
 limit, but I'm not sure.
 Maybe you have simply found a bottleneck in threads. Did you also try 
 increasing the number of threads instead of adding more processes? 
 Multi-threaded apache is supposed to be faster than multi-process apache 
 under real load (i.e. multiple users) because starting (and switching) 
 processes is expensive in time and memory.*
 So any conclusion that you need more processes is dubious, I think. I 
 can't recall how many simultaneous users your benchmarking is testing. 
 Bear in mind that the fastest servers, the greenlet or co-operative async 
 servers, are not only limited to one process, but even to one thread. 

 http://nichol.as/benchmark-of-python-web-servers










 On Wednesday, 19 March 2014 14:25:47 UTC+11, horridohobbyist wrote:

 I shall do that. Thanks.

 With the knowledge about processes=, I've tuned my actual Linux server 
 to eliminate the 10x slowdown. As it turns out, for my 2.4GHz quad-core 
 Xeon with 4GB RAM, processes=2 works best. I found that any other value 
 (3, 4, 5) gave very inconsistent results–sometimes I would get 1x (the 
 ideal) and sometimes I would get 10x. Very bizarre.

 processes=2 is counter-intuitive. After all, I have 4 cores. Why 
 shouldn't processes=4 be good?

 Anyway, not only is the shipping code fast, but I find that my overall 
 web2py app feels a lot snappier. Is it just my imagination?

 If processes=2 is boosting the speed of Python in general, then you 
 would expect all of web2py to benefit. So maybe it's not my imagination.

 Anyway, the takeaway, I think, is that you must tune the Apache 
 configuration for the particular server hardware that you have. The default 
 processes=1 is not good enough.


 On Tuesday, 18 March 2014 22:37:58 UTC-4, Massimo Di Pierro wrote:

 Thank you for all your tests. You should write a summary of your 
 results with recommendations for Apache users.

 On Tuesday, 18 March 2014 19:44:29 UTC-5, horridohobbyist wrote:

 Done. With processes=3, the 10x discrepancy is eliminated! (And this 
 is in a Linux VM configured for 1 CPU.)


 On Tuesday, 18 March 2014 16:26:24 UTC-4, Michele Comitini wrote:

  WSGIDaemonProcess hello user=www-data group=www-data threads=5 

 with web2py try the following instead: 
 WSGIDaemonProcess hello user=www-data group=www-data 
 processes=number 
 of cores + 1 threads=(0 or 1) 

 If it's faster, then the GIL must be the cause.  flask by default has 
 much less features active (session for instance) 



 2014-03-18 21:04 GMT+01:00 horridohobbyist horrido...@gmail.com: 
  I took the shipping code that I ran in Flask (without Apache) and 
 adapted it 
  to run under Apache as a Flask app. That way, I'm comparing apples 
 to 
  apples. I'm comparing the performance of the shipping code between 
 Flask and 
  web2py. 
  
  Below, I've included the 'default' file from 
 Apache2/sites-available for 
  Flask. 
  
  Basically, the code in Flask executes 10x faster than the same code 
 in 
  web2py. So my question is:  if Apache is at fault for the web2py 
 app's slow 
  performance, why doesn't Apache hurt the Flask app's performance? 
 (This 
  doesn't seem to be related to GIL or WSGI.) 
  
  
  VirtualHost *:80 
ServerName 10.211.55.7 
WSGIDaemonProcess hello user=www-data group=www-data threads=5 
WSGIScriptAlias / /home/richard/welcome/hello.wsgi 
  
Directory /home/richard/welcome 
  Order Allow,Deny 
  Allow from all 
/Directory 
  /VirtualHost 
  
  

[web2py] howto: ajax call in FORM with signed URL

2014-03-19 Thread Mike Constabel
Hi,

in a form i have

TD(INPUT(_id='keyword', _name='keyword', _onkeyup=ajax(URL('callback', 
['keyword', 'stype']), 'target');), _name=search_type)))

If a text is entered, callback is called an some text is displayed in 
target. This works.

But now I want to sign the URL.

If I add @auth.requires_signature() to callback function, it no longer 
works. The ajax call must be signed.

@auth.requires_signature()
def callback():
return P(foo)

But how can I add user_signature=True to the code above so that the ajax 
call will be signed?

Regards,
Mike

-- 
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] calling download function page by ajax

2014-03-19 Thread Richard Vézina
Thanks for suggestion!

Richard


On Wed, Mar 19, 2014 at 1:23 AM, Limedrop russ...@holtrd.com wrote:

 Posted to soon.  To clarify, the cookies need to be set in your download
 function:

   {{view}}

 response.files.append(URL('static','jquery.fileDownload/jquery.fileDownload.js'))



   {{controller}}
   response.js = '$.fileDownload(
 http://127.0.0.1:8000/sgddms/label/download_func1?var1=2676var1=2673var1=2678
 );'
   response.js += '$.fileDownload(
 http://127.0.0.1:8000/sgddms/label/download_func1?var1=2676var1=2673var1=2678
 );'


   {{download_func1}}

   # these cookies are required by jQuery.fileDownload.js
   # to enable download via ajax
   response.cookies['fileDownload'] = 'true'
   response.cookies['fileDownload']['path'] = /



 On Wednesday, March 19, 2014 6:18:11 PM UTC+13, Limedrop wrote:

 You might want to look at http://johnculviner.com/
 jquery-file-download-plugin-for-ajax-like-feature-rich-file-downloads/

 The only fiddly bit is to make sure you set the cookies correctly (see
 the documentation for details).

 For example:

   {{view}}
   response.files.append(URL('static','js/jquery.fileDownload/jquery.
 fileDownload.js'))


   {{controller}}
   response.js = '$.fileDownload(http://127.0.0.1:8000/sgddms/label/
 download_func1?var1=2676var1=2673var1=2678);'
   response.js += '$.fileDownload(http://127.0.0.1:8000/sgddms/label/
 download_func1?var1=2676var1=2673var1=2678);'
   # these cookies are required by jQuery.fileDownload.js
   # to enable download via ajax
   response.cookies['fileDownload'] = 'true'
   response.cookies['fileDownload']['path'] = /






  --
 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] Re: Database access without DAL but with connection pool

2014-03-19 Thread Massimo Di Pierro
I am not sure about pymongo but if you use 

DAL('mongodb:')

the dal will do pooling for you.

On Wednesday, 19 March 2014 01:33:04 UTC-5, tec...@gmail.com wrote:

 Dear Sirs,


 I understand it's possible to use databases without DAL.
 For example function in controller:

 def values():
 client = pymongo.MongoClient('localhost', 27017)
 db = client.mybase
 mytable = db[mytable]
 res = mytable.find()
 .

 return dict()

 And of course it works.
 But is it fast to connect/disconnect every time in function? What's about 
 connection pool?
 I consider connection pool could increase access to database. 

 1. Actually I would like to ask how to access to database without DAL but 
 at maximum speed?
 2. Do I need connection pool for fast database access? (I think, yes.)
 3. How could I build custom connection pool for database access without 
 DAL? Or any solution to re-use connections to database server? Any examples?



 Andrey A.


-- 
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] REF: Downloading static files with spaces gives an error

2014-03-19 Thread Teddy Nyambe
I have trying to download files stored in static/upload/my file.pdf, it
returns page not found. But when i remove spaces and change the static
file, it works.

Any ideas on why this behaviour or explanation?

-- 
...
Teddy Lubasi Nyambe
Opensource Zambia

-- 
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] pysimplesoap help

2014-03-19 Thread Mariano Reingart
Could you send me the content of client.response (http headers)?
Maybe it is returning a cookie or something equivalent
Then, you can update client.http_headers with them and it should work

Best regards,

Mariano Reingart
http://www.sistemasagiles.com.ar
http://reingart.blogspot.com


On Wed, Mar 19, 2014 at 7:40 AM, piero crisci piero.cri...@gmail.comwrote:

 Hi mariano i still got some problem
 I solved the problem with the basic authentication but i still have some
 problem on calling webservice.
 The webservice infact need a first call for the db connection ('init' )
 After this call you can call the other services.
 I made this code :

 from pysimplesoap.client import SoapClient
 from pysimplesoap.client import SoapClient, SimpleXMLElement
 location_wsdl =  *http://docway.demo.3di.it http://docway.demo.3di.it*
 /3diws/services/eXtraWayhttp://docway.demo.3di.it/3diws/services/eXtraWay
 
 wsdl =  *http://docway.demo.3di.it/ http://docway.demo.3di.it/*
 /3diws/services/eXtraWay?wsdlhttp://10.55.38.247:8080/3diws/services/eXtraWay?wsdl
 
 namespace_wsdl =  
 *http://docway.demo.3di.it/*http://www.google.com/url?q=http%3A%2F%2Fdocway.demo.3di.it%2F3diws%2Fservices%2FeXtraWay%3Fwsdlsa=Dsntz=1usg=AFQjCNFAe47af7Nlfx1k8KJR8x-hsRTOAg
 3diws/services/eXtraWay http://10.55.38.247:8080/3diws/services/eXtraWay
 
 import base64
 username='admin'
 password=''

 auth = base64.b64encode('%s:%s' % (username, password))
 client = SoapClient(location = location_wsdl, 
 wsdl=wsdl,*sessions=True,*namespace=namespace_wsdl, 
 http_headers={'Authorization': Basic %s %
 auth},username=username,password=password)
 client['AuthHeaderElement'] = {'Authorization': Basic %s % auth}

 client.send('init',xml=xml_init)
 client.send('executeQuery',xml=xml_execute_query)
 When i call the 'executeQuery' i got as response that the connection is
 not established. The connection should be established with the 'Init'
 call .
 I got the same problem with SOAPUI but i managed to solve the problem
 activating the option Maintain HTTP Session
 Even putting sessions = True is not solving the problem
 Thank for help
 Piero

 Il giorno martedì 18 marzo 2014 07:26:35 UTC+1, Mariano Reingart ha
 scritto:

 Hi piero:

 The first choice to connect to a webservice that requires username 
 password (add_credentials), you will httplib2 installed:

 https://code.google.com/p/httplib2

 Then you could do:

 client = SoapClient(location = location_wsdl,sessions=True,us
 ername='admin',password='xx')

 Also, assuming your webservice supports basic auth, you could pass the
 Authentication http header directly (it shouldn't need to install external
 library):

 import base64
 auth = base64.b64encode('%s:%s' % (username, password)).replace('\n', '')

 client = SoapClient(location = location_wsdl, sessions=True,
 http_headers={'Authorization': Basic %s % auth})

 Let me know if this solves your issue,

 Best regards


 Mariano Reingart
 http://www.sistemasagiles.com.ar
 http://reingart.blogspot.com


 On Mon, Mar 17, 2014 at 6:02 PM, piero crisci piero@gmail.comwrote:

  Hello i am trying to connect to this wsdl: http://docway.demo.3di.it/
 3diws/services/eXtraWay?wsdl
 It requires http basic authentication  and i am using pysimplesoap 1.10
 and i tried this configuration:

 from pysimplesoap.client import SoapClient
 location_wsdl = http://docway.demo.3di.it/3diws/services;
 wsdl = http://docway.demo.3di.it/3diws/services/eXtraWay?wsdl;
 client = SoapClient(location = 
 location_wsdl,sessions=True,http_headers={'username':
 'admin', 'password': ''},username='admin',password='xx')

 I got this error
 Traceback (most recent call last):
   File stdin, line 1, in module
   File build\bdist.win32\egg\pysimplesoap\client.py, line 133, in
 __init__
   File build\bdist.win32\egg\pysimplesoap\client.py, line 469, in
 wsdl_parse
   File build\bdist.win32\egg\pysimplesoap\helpers.py, line 71, in
 fetch
   File build\bdist.win32\egg\pysimplesoap\transport.py, line 121, in
 request
   File C:\python27\lib\urllib2.py, line 406, in open
 response = meth(req, response)
   File C:\python27\lib\urllib2.py, line 519, in http_response
 'http', request, response, code, msg, hdrs)
   File C:\python27\lib\urllib2.py, line 444, in error
 return self._call_chain(*args)
   File C:\python27\lib\urllib2.py, line 378, in _call_chain
 result = func(*args)
   File C:\python27\lib\urllib2.py, line 527, in http_error_default
 raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
 urllib2.HTTPError: HTTP Error 401: Unauthorized

 It seems like the basic authenitcation is not supported. am I wrong?
 How i need to change the wsdl call? And how i can use a session to send
 different call?
 Thx for help!

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

[web2py] Re: dashboard using bootstrap

2014-03-19 Thread Anubhav Singh
hi Massimo Di Pierro,
 this is very useful for bootstrap user 
. thanks for post... 

-- 
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] uploading a csv file and read it with python module pandas

2014-03-19 Thread Gaston
I am statistician and new in web2py.
I tried to build an application that allows users to:

   - upload a csv file in the database (my file)
   - and click a link where some automated analyses have been attached 
   using the python module pandas with (import pandas as pd)


In the db.py, I have
db.define_table('mytable',Field('myfile','upload'))


In the default.py I have the below lines
def stat():
   data=pd.read.csv('myfile')


I received the following error:

type 'exceptions.AttributeError'('module' object has no attribute 'read')

Great if someone could help. Thanks. Gaston

-- 
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] Boots trap user graph

2014-03-19 Thread Anubhav Singh
hi guys,
   is there any easy script for create a user log graph . if yes 
please help me because i have little knowledge of j-query . while i was 
searching on google there are all result come with j-query and also with 
very difficult  script .. help me please ... thanks 2 all

-- 
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] calling download function page by ajax

2014-03-19 Thread Richard Vézina
I found this workaround :

response.js = window.open('%(url1)s'); window.open('%(url2)s'); %
{'url1': URL(c='controller', f='func1', extension=False,
vars=dict(var1=var1, **var2_dict)), 'url2': URL(c='controller', f='func2',
extension=False, vars=dict(var1=var1))}

As one of the suggestion of Niphold...

Thanks for your help!

Richard


On Wed, Mar 19, 2014 at 9:32 AM, Richard Vézina ml.richard.vez...@gmail.com
 wrote:

 Thanks for suggestion!

 Richard


 On Wed, Mar 19, 2014 at 1:23 AM, Limedrop russ...@holtrd.com wrote:

 Posted to soon.  To clarify, the cookies need to be set in your download
 function:

   {{view}}

 response.files.append(URL('static','jquery.fileDownload/jquery.fileDownload.js'))



   {{controller}}
   response.js = '$.fileDownload(
 http://127.0.0.1:8000/sgddms/label/download_func1?var1=2676var1=2673var1=2678
 );'
   response.js += '$.fileDownload(
 http://127.0.0.1:8000/sgddms/label/download_func1?var1=2676var1=2673var1=2678
 );'


   {{download_func1}}

   # these cookies are required by jQuery.fileDownload.js
   # to enable download via ajax
   response.cookies['fileDownload'] = 'true'
   response.cookies['fileDownload']['path'] = /



 On Wednesday, March 19, 2014 6:18:11 PM UTC+13, Limedrop wrote:

 You might want to look at http://johnculviner.com/
 jquery-file-download-plugin-for-ajax-like-feature-rich-file-downloads/

 The only fiddly bit is to make sure you set the cookies correctly (see
 the documentation for details).

 For example:

   {{view}}
   response.files.append(URL('static','js/jquery.fileDownload/jquery.
 fileDownload.js'))


   {{controller}}
   response.js = '$.fileDownload(http://127.0.0.1:8000/sgddms/label/
 download_func1?var1=2676var1=2673var1=2678);'
   response.js += '$.fileDownload(http://127.0.0.1:8000/sgddms/label/
 download_func1?var1=2676var1=2673var1=2678);'
   # these cookies are required by jQuery.fileDownload.js
   # to enable download via ajax
   response.cookies['fileDownload'] = 'true'
   response.cookies['fileDownload']['path'] = /






  --
 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] Re: Database access without DAL but with connection pool

2014-03-19 Thread tech . uz
Hello Massimo,

Thank you for reply.

On Wednesday, March 19, 2014 7:20:27 PM UTC+5, Massimo Di Pierro wrote:

 I am not sure about pymongo but if you use 

 DAL('mongodb:')

 the dal will do pooling for you.

Ok, I will check this.


Actually I don't want to use pymongo only, it could any database which DAL 
doesn't support.
As I wrote before I think it's not good idea to connect (disconnect) to 
database in controller function.
Could you (anybody) provide example of custom connection pool? Just checked 
web2py resources, no any single example? 



Andrey A.
 


 On Wednesday, 19 March 2014 01:33:04 UTC-5, tec...@gmail.com wrote:

 Dear Sirs,


 I understand it's possible to use databases without DAL.
 For example function in controller:

 def values():
 client = pymongo.MongoClient('localhost', 27017)
 db = client.mybase
 mytable = db[mytable]
 res = mytable.find()
 .

 return dict()

 And of course it works.
 But is it fast to connect/disconnect every time in function? What's about 
 connection pool?
 I consider connection pool could increase access to database. 

 1. Actually I would like to ask how to access to database without DAL but 
 at maximum speed?
 2. Do I need connection pool for fast database access? (I think, yes.)
 3. How could I build custom connection pool for database access without 
 DAL? Or any solution to re-use connections to database server? Any examples?



 Andrey A.



-- 
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: REF: Downloading static files with spaces gives an error

2014-03-19 Thread LightDot
Vital parts of information are missing - are the files served by Rocket , 
Apache, or..? How is the file being downloaded? By a browser request? How 
is the request formulated, are you following a link or entering the URL by 
typing it directly?

Regards

On Wednesday, March 19, 2014 3:24:03 PM UTC+1, software.ted wrote:

 I have trying to download files stored in static/upload/my file.pdf, it 
 returns page not found. But when i remove spaces and change the static 
 file, it works.

 Any ideas on why this behaviour or explanation?

 -- 

 ...
 Teddy Lubasi Nyambe
 Opensource Zambia



-- 
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: Database access without DAL but with connection pool

2014-03-19 Thread LightDot
Well, if you want to do it without the DAL, there are several options that 
might just work without any additional code:
- check if specific python libs that you'll use for the db connection 
already provide a similar pooling function, they might
- check if the database backend natively provides such a function.

If neither is applicable... I suggest extending the DAL to support a new 
database ;)

Regards

On Wednesday, March 19, 2014 3:49:39 PM UTC+1, tec...@gmail.com wrote:

 Hello Massimo,

 Thank you for reply.

 On Wednesday, March 19, 2014 7:20:27 PM UTC+5, Massimo Di Pierro wrote:

 I am not sure about pymongo but if you use 

 DAL('mongodb:')

 the dal will do pooling for you.

 Ok, I will check this.


 Actually I don't want to use pymongo only, it could any database which DAL 
 doesn't support.
 As I wrote before I think it's not good idea to connect (disconnect) to 
 database in controller function.
 Could you (anybody) provide example of custom connection pool? Just 
 checked web2py resources, no any single example? 



 Andrey A.
  


 On Wednesday, 19 March 2014 01:33:04 UTC-5, tec...@gmail.com wrote:

 Dear Sirs,


 I understand it's possible to use databases without DAL.
 For example function in controller:

 def values():
 client = pymongo.MongoClient('localhost', 27017)
 db = client.mybase
 mytable = db[mytable]
 res = mytable.find()
 .

 return dict()

 And of course it works.
 But is it fast to connect/disconnect every time in function? What's 
 about connection pool?
 I consider connection pool could increase access to database. 

 1. Actually I would like to ask how to access to database without DAL 
 but at maximum speed?
 2. Do I need connection pool for fast database access? (I think, yes.)
 3. How could I build custom connection pool for database access without 
 DAL? Or any solution to re-use connections to database server? Any examples?



 Andrey A.



-- 
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] pysimplesoap help

2014-03-19 Thread piero crisci
*this is the client obj*
client = SoapClient(
location=location_wsdl,
wsdl=wsdl,
ns = ns,
sessions=True,
trace=True, 
http_headers={'Authorization': Basic %s % 
auth},username=username,password=password)
client['AuthHeaderElement'] = {'Authorization': Basic %s % auth}
client['http_header'] = {'Authorization': Basic %s % auth}

*This is the the 'init' call*
client.call('init',('host','localhost'),('port','4859'),('user','CRSPRIX),('password',''),('pnumber',''),('db','XX'),('encoding',None),('titlePageSize',10),('indexPageSize',10))
 
*And this is the 'init' response*

{'status': '200', 'transfer-encoding': 'chunked', 'set-cookie': 
'JSESSIONID=4EDBE009B6A581E6023B9203365BF1EC; Path=/3diws', 'server': 
'Apache-Coyote/1.1', 'date': 'Wed, 19 Mar 2014 15:23:24 GMT', 
'content-type': 'text/xml;charset=utf-8'}

*This is the the 'executeQuery' call*
client.call('executeQuery',('query','[/doc/@nrecord]=00503459'))

*This is the response to the 'ExecuteQuery' call*
{'status': '500', 'transfer-encoding': 'chunked', 'set-cookie': 
'JSESSIONID=ECC4905C2D52F7456F4968E2C30D6639; Path=/3diws', 'server': 
'Apache-Coyote/1.1', 'connection': 'close', 'date': 'Wed, 19 Mar 2014 
15:25:26 GMT', 'content-type': 'text/xml;charset=utf-8'}



Il giorno mercoledì 19 marzo 2014 15:25:45 UTC+1, Mariano Reingart ha 
scritto:

 Could you send me the content of client.response (http headers)?
 Maybe it is returning a cookie or something equivalent 
 Then, you can update client.http_headers with them and it should work

 Best regards,

 Mariano Reingart
 http://www.sistemasagiles.com.ar
 http://reingart.blogspot.com


 On Wed, Mar 19, 2014 at 7:40 AM, piero crisci 
 piero@gmail.comjavascript:
  wrote:

 Hi mariano i still got some problem
 I solved the problem with the basic authentication but i still have some 
 problem on calling webservice.
 The webservice infact need a first call for the db connection ('init' )
 After this call you can call the other services.
 I made this code :
  
 from pysimplesoap.client import SoapClient
 from pysimplesoap.client import SoapClient, SimpleXMLElement
 location_wsdl =  *http://docway.demo.3di.it http://docway.demo.3di.it*
 /3diws/services/eXtraWayhttp://docway.demo.3di.it/3diws/services/eXtraWay
 
 wsdl =  *http://docway.demo.3di.it/ http://docway.demo.3di.it/*
 /3diws/services/eXtraWay?wsdlhttp://10.55.38.247:8080/3diws/services/eXtraWay?wsdl
 
 namespace_wsdl =  
 *http://docway.demo.3di.it/*http://www.google.com/url?q=http%3A%2F%2Fdocway.demo.3di.it%2F3diws%2Fservices%2FeXtraWay%3Fwsdlsa=Dsntz=1usg=AFQjCNFAe47af7Nlfx1k8KJR8x-hsRTOAg
 3diws/services/eXtraWayhttp://10.55.38.247:8080/3diws/services/eXtraWay
 
 import base64
 username='admin'
 password=''

 auth = base64.b64encode('%s:%s' % (username, password))
 client = SoapClient(location = location_wsdl, 
 wsdl=wsdl,*sessions=True,*namespace=namespace_wsdl, 
 http_headers={'Authorization': Basic %s % 
 auth},username=username,password=password)
 client['AuthHeaderElement'] = {'Authorization': Basic %s % auth}

 client.send('init',xml=xml_init)
 client.send('executeQuery',xml=xml_execute_query)
 When i call the 'executeQuery' i got as response that the connection is 
 not established. The connection should be established with the 'Init' 
 call . 
 I got the same problem with SOAPUI but i managed to solve the problem 
 activating the option Maintain HTTP Session
 Even putting sessions = True is not solving the problem
 Thank for help 
 Piero

 Il giorno martedì 18 marzo 2014 07:26:35 UTC+1, Mariano Reingart ha 
 scritto:

 Hi piero:

 The first choice to connect to a webservice that requires username  
 password (add_credentials), you will httplib2 installed:

 https://code.google.com/p/httplib2

 Then you could do:

 client = SoapClient(location = location_wsdl,sessions=True,us
 ername='admin',password='xx')

 Also, assuming your webservice supports basic auth, you could pass the 
 Authentication http header directly (it shouldn't need to install external 
 library):

 import base64
 auth = base64.b64encode('%s:%s' % (username, password)).replace('\n', '')

 client = SoapClient(location = location_wsdl, sessions=True, 
 http_headers={'Authorization': Basic %s % auth})

 Let me know if this solves your issue,

 Best regards


 Mariano Reingart
 http://www.sistemasagiles.com.ar
 http://reingart.blogspot.com


 On Mon, Mar 17, 2014 at 6:02 PM, piero crisci piero@gmail.comwrote:

  Hello i am trying to connect to this wsdl: http://docway.demo.3di.it/
 3diws/services/eXtraWay?wsdl 
 It requires http basic authentication  and i am using pysimplesoap 1.10 
 and i tried this configuration:

 from pysimplesoap.client import SoapClient
 location_wsdl = http://docway.demo.3di.it/3diws/services;
 wsdl = http://docway.demo.3di.it/3diws/services/eXtraWay?wsdl;
 client = SoapClient(location = 
 location_wsdl,sessions=True,http_headers={'username': 
 'admin', 'password': ''},username='admin',password='xx')

 I got this 

[web2py] Re: howto: ajax call in FORM with signed URL

2014-03-19 Thread LightDot
Try:

TD(INPUT(_id='keyword', _name='keyword', _onkeyup=ajax(URL('callback', 
['keyword', 'stype'], user_signature=True), 'target');), _name=
search_type)))

Regards

On Wednesday, March 19, 2014 1:59:38 PM UTC+1, Mike Constabel wrote:

 Hi,

 in a form i have

 TD(INPUT(_id='keyword', _name='keyword', _onkeyup=ajax(URL('callback', 
 ['keyword', 'stype']), 'target');), _name=search_type)))

 If a text is entered, callback is called an some text is displayed in 
 target. This works.

 But now I want to sign the URL.

 If I add @auth.requires_signature() to callback function, it no longer 
 works. The ajax call must be signed.

 @auth.requires_signature()
 def callback():
 return P(foo)

 But how can I add user_signature=True to the code above so that the ajax 
 call will be signed?

 Regards,
 Mike


-- 
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] pysimplesoap help

2014-03-19 Thread Mariano Reingart
This should work:

*# call the autentication remote method:*


*client.call('init',('host','localhost'),('port','4859'),('user','CRSPRIX),('password',''),('pnumber',''),('db','XX'),('encoding',None),('titlePageSize',10),('indexPageSize',10))
*

*# set the cookie*

 *client.http headers['Cookie'] = client.response['set-cookie']*

*# call the methods that need the cookie:*

*client.call('executeQuery',('query','[/doc/@nrecord]=00503459'))*

Please confirm if that work, so I can add it to pysimplesoap library

Best regards,


Mariano Reingart
http://www.sistemasagiles.com.ar
http://reingart.blogspot.com


On Wed, Mar 19, 2014 at 12:29 PM, piero crisci piero.cri...@gmail.comwrote:

 *this is the client obj*
 client = SoapClient(
 location=location_wsdl,
 wsdl=wsdl,
 ns = ns,
 sessions=True,
 trace=True,
 http_headers={'Authorization': Basic %s %
 auth},username=username,password=password)
 client['AuthHeaderElement'] = {'Authorization': Basic %s % auth}
 client['http_header'] = {'Authorization': Basic %s % auth}

 *This is the the 'init' call*

 client.call('init',('host','localhost'),('port','4859'),('user','CRSPRIX),('password',''),('pnumber',''),('db','XX'),('encoding',None),('titlePageSize',10),('indexPageSize',10))

 *And this is the 'init' response*

 {'status': '200', 'transfer-encoding': 'chunked', 'set-cookie':
 'JSESSIONID=4EDBE009B6A581E6023B9203365BF1EC; Path=/3diws', 'server':
 'Apache-Coyote/1.1', 'date': 'Wed, 19 Mar 2014 15:23:24 GMT',
 'content-type': 'text/xml;charset=utf-8'}

 *This is the the 'executeQuery' call*
 client.call('executeQuery',('query','[/doc/@nrecord]=00503459'))

 *This is the response to the 'ExecuteQuery' call*
 {'status': '500', 'transfer-encoding': 'chunked', 'set-cookie':
 'JSESSIONID=ECC4905C2D52F7456F4968E2C30D6639; Path=/3diws', 'server':
 'Apache-Coyote/1.1', 'connection': 'close', 'date': 'Wed, 19 Mar 2014
 15:25:26 GMT', 'content-type': 'text/xml;charset=utf-8'}



 Il giorno mercoledì 19 marzo 2014 15:25:45 UTC+1, Mariano Reingart ha
 scritto:

 Could you send me the content of client.response (http headers)?
 Maybe it is returning a cookie or something equivalent
 Then, you can update client.http_headers with them and it should work

 Best regards,

 Mariano Reingart
 http://www.sistemasagiles.com.ar
 http://reingart.blogspot.com


 On Wed, Mar 19, 2014 at 7:40 AM, piero crisci piero@gmail.comwrote:

 Hi mariano i still got some problem
 I solved the problem with the basic authentication but i still have some
 problem on calling webservice.
 The webservice infact need a first call for the db connection ('init' )
 After this call you can call the other services.
 I made this code :

 from pysimplesoap.client import SoapClient
 from pysimplesoap.client import SoapClient, SimpleXMLElement
 location_wsdl =  *http://docway.demo.3di.it
 http://docway.demo.3di.it*/3diws/services/eXtraWayhttp://docway.demo.3di.it/3diws/services/eXtraWay
 
 wsdl =  *http://docway.demo.3di.it/ http://docway.demo.3di.it/*/
 3diws/services/eXtraWay?wsdlhttp://10.55.38.247:8080/3diws/services/eXtraWay?wsdl
 
 namespace_wsdl =  
 *http://docway.demo.3di.it/*http://www.google.com/url?q=http%3A%2F%2Fdocway.demo.3di.it%2F3diws%2Fservices%2FeXtraWay%3Fwsdlsa=Dsntz=1usg=AFQjCNFAe47af7Nlfx1k8KJR8x-hsRTOAg
 3diws/services/eXtraWayhttp://10.55.38.247:8080/3diws/services/eXtraWay
 
 import base64
 username='admin'
 password=''

 auth = base64.b64encode('%s:%s' % (username, password))
 client = SoapClient(location = location_wsdl, 
 wsdl=wsdl,*sessions=True,*namespace=namespace_wsdl, 
 http_headers={'Authorization': Basic %s %
 auth},username=username,password=password)
 client['AuthHeaderElement'] = {'Authorization': Basic %s % auth}

 client.send('init',xml=xml_init)
 client.send('executeQuery',xml=xml_execute_query)
  When i call the 'executeQuery' i got as response that the connection is
 not established. The connection should be established with the 'Init'
 call .
 I got the same problem with SOAPUI but i managed to solve the problem
 activating the option Maintain HTTP Session
 Even putting sessions = True is not solving the problem
 Thank for help
 Piero

 Il giorno martedì 18 marzo 2014 07:26:35 UTC+1, Mariano Reingart ha
 scritto:

 Hi piero:

 The first choice to connect to a webservice that requires username 
 password (add_credentials), you will httplib2 installed:

 https://code.google.com/p/httplib2

 Then you could do:

 client = SoapClient(location = location_wsdl,sessions=True,us
 ername='admin',password='xx')

 Also, assuming your webservice supports basic auth, you could pass the
 Authentication http header directly (it shouldn't need to install external
 library):

 import base64
 auth = base64.b64encode('%s:%s' % (username, password)).replace('\n',
 '')

 client = SoapClient(location = location_wsdl, sessions=True,
 http_headers={'Authorization': Basic %s % auth})

 Let me know if this solves your issue,

 Best regards


 Mariano 

Re: [web2py] pysimplesoap help

2014-03-19 Thread piero crisci
Yes it works!

Il giorno mercoledì 19 marzo 2014 17:51:42 UTC+1, Mariano Reingart ha 
scritto:

 Sorry, I forgot the underscore in http_headers in the set th cookie part

 *client.http_headers['Cookie'] = client.response['set-cookie']*

 Regards,

 Mariano Reingart
 http://www.sistemasagiles.com.ar
 http://reingart.blogspot.com


 On Wed, Mar 19, 2014 at 1:50 PM, Mariano Reingart 
 rein...@gmail.comjavascript:
  wrote:

 This should work:

 *# call the autentication remote method:*

  
 *client.call('init',('host','localhost'),('port','4859'),('user','CRSPRIX),('password',''),('pnumber',''),('db','XX'),('encoding',None),('titlePageSize',10),('indexPageSize',10))
  
 *

 *# set the cookie*

  *client.http headers['Cookie'] = client.response['set-cookie']*

 *# call the methods that need the cookie:*

 *client.call('executeQuery',('query','[/doc/@nrecord]=00503459'))*

 Please confirm if that work, so I can add it to pysimplesoap library

 Best regards,


 Mariano Reingart
 http://www.sistemasagiles.com.ar
 http://reingart.blogspot.com


 On Wed, Mar 19, 2014 at 12:29 PM, piero crisci 
 piero@gmail.comjavascript:
  wrote:

 *this is the client obj*
 client = SoapClient(
 location=location_wsdl,
 wsdl=wsdl,
 ns = ns,
 sessions=True,
 trace=True, 
 http_headers={'Authorization': Basic %s % 
 auth},username=username,password=password)
 client['AuthHeaderElement'] = {'Authorization': Basic %s % auth}
 client['http_header'] = {'Authorization': Basic %s % auth}

 *This is the the 'init' call*

 client.call('init',('host','localhost'),('port','4859'),('user','CRSPRIX),('password',''),('pnumber',''),('db','XX'),('encoding',None),('titlePageSize',10),('indexPageSize',10))
  
 *And this is the 'init' response*

 {'status': '200', 'transfer-encoding': 'chunked', 'set-cookie': 
 'JSESSIONID=4EDBE009B6A581E6023B9203365BF1EC; Path=/3diws', 'server': 
 'Apache-Coyote/1.1', 'date': 'Wed, 19 Mar 2014 15:23:24 GMT', 
 'content-type': 'text/xml;charset=utf-8'}

 *This is the the 'executeQuery' call*
 client.call('executeQuery',('query','[/doc/@nrecord]=00503459'))

 *This is the response to the 'ExecuteQuery' call*
 {'status': '500', 'transfer-encoding': 'chunked', 'set-cookie': 
 'JSESSIONID=ECC4905C2D52F7456F4968E2C30D6639; Path=/3diws', 'server': 
 'Apache-Coyote/1.1', 'connection': 'close', 'date': 'Wed, 19 Mar 2014 
 15:25:26 GMT', 'content-type': 'text/xml;charset=utf-8'}



 Il giorno mercoledì 19 marzo 2014 15:25:45 UTC+1, Mariano Reingart ha 
 scritto:

 Could you send me the content of client.response (http headers)?
 Maybe it is returning a cookie or something equivalent 
 Then, you can update client.http_headers with them and it should work

 Best regards,

 Mariano Reingart
 http://www.sistemasagiles.com.ar
 http://reingart.blogspot.com


 On Wed, Mar 19, 2014 at 7:40 AM, piero crisci piero@gmail.comwrote:

 Hi mariano i still got some problem
 I solved the problem with the basic authentication but i still have 
 some problem on calling webservice.
 The webservice infact need a first call for the db connection ('init' )
 After this call you can call the other services.
 I made this code :
  
 from pysimplesoap.client import SoapClient
 from pysimplesoap.client import SoapClient, SimpleXMLElement
 location_wsdl =  *http://docway.demo.3di.it 
 http://docway.demo.3di.it*/3diws/services/eXtraWayhttp://docway.demo.3di.it/3diws/services/eXtraWay
 
 wsdl =  *http://docway.demo.3di.it/ http://docway.demo.3di.it/*/
 3diws/services/eXtraWay?wsdlhttp://10.55.38.247:8080/3diws/services/eXtraWay?wsdl
 
 namespace_wsdl =  
 *http://docway.demo.3di.it/*http://www.google.com/url?q=http%3A%2F%2Fdocway.demo.3di.it%2F3diws%2Fservices%2FeXtraWay%3Fwsdlsa=Dsntz=1usg=AFQjCNFAe47af7Nlfx1k8KJR8x-hsRTOAg
 3diws/services/eXtraWayhttp://10.55.38.247:8080/3diws/services/eXtraWay
 
 import base64
 username='admin'
 password=''

 auth = base64.b64encode('%s:%s' % (username, password))
 client = SoapClient(location = location_wsdl, wsdl=wsdl,
 *sessions=True,* namespace=namespace_wsdl, 
 http_headers={'Authorization': Basic %s % auth},username=username,
 password=password)
 client['AuthHeaderElement'] = {'Authorization': Basic %s % auth}

 client.send('init',xml=xml_init)
 client.send('executeQuery',xml=xml_execute_query)
  When i call the 'executeQuery' i got as response that the connection 
 is not established. The connection should be established with the 'Init' 
 call . 
 I got the same problem with SOAPUI but i managed to solve the problem 
 activating the option Maintain HTTP Session
 Even putting sessions = True is not solving the problem
 Thank for help 
 Piero

 Il giorno martedì 18 marzo 2014 07:26:35 UTC+1, Mariano Reingart ha 
 scritto:

 Hi piero:

 The first choice to connect to a webservice that requires username  
 password (add_credentials), you will httplib2 installed:

 https://code.google.com/p/httplib2

 Then you could do:

 client = SoapClient(location = 

Re: [web2py] pysimplesoap help

2014-03-19 Thread Mariano Reingart
Sorry, I forgot the underscore in http_headers in the set th cookie part

*client.http_headers['Cookie'] = client.response['set-cookie']*

Regards,

Mariano Reingart
http://www.sistemasagiles.com.ar
http://reingart.blogspot.com


On Wed, Mar 19, 2014 at 1:50 PM, Mariano Reingart reing...@gmail.comwrote:

 This should work:

 *# call the autentication remote method:*


 *client.call('init',('host','localhost'),('port','4859'),('user','CRSPRIX),('password',''),('pnumber',''),('db','XX'),('encoding',None),('titlePageSize',10),('indexPageSize',10))
 *

 *# set the cookie*

  *client.http headers['Cookie'] = client.response['set-cookie']*

 *# call the methods that need the cookie:*

 *client.call('executeQuery',('query','[/doc/@nrecord]=00503459'))*

 Please confirm if that work, so I can add it to pysimplesoap library

 Best regards,


 Mariano Reingart
 http://www.sistemasagiles.com.ar
 http://reingart.blogspot.com


 On Wed, Mar 19, 2014 at 12:29 PM, piero crisci piero.cri...@gmail.comwrote:

 *this is the client obj*
 client = SoapClient(
 location=location_wsdl,
 wsdl=wsdl,
 ns = ns,
 sessions=True,
 trace=True,
 http_headers={'Authorization': Basic %s %
 auth},username=username,password=password)
 client['AuthHeaderElement'] = {'Authorization': Basic %s % auth}
 client['http_header'] = {'Authorization': Basic %s % auth}

 *This is the the 'init' call*

 client.call('init',('host','localhost'),('port','4859'),('user','CRSPRIX),('password',''),('pnumber',''),('db','XX'),('encoding',None),('titlePageSize',10),('indexPageSize',10))

 *And this is the 'init' response*

 {'status': '200', 'transfer-encoding': 'chunked', 'set-cookie':
 'JSESSIONID=4EDBE009B6A581E6023B9203365BF1EC; Path=/3diws', 'server':
 'Apache-Coyote/1.1', 'date': 'Wed, 19 Mar 2014 15:23:24 GMT',
 'content-type': 'text/xml;charset=utf-8'}

 *This is the the 'executeQuery' call*
 client.call('executeQuery',('query','[/doc/@nrecord]=00503459'))

 *This is the response to the 'ExecuteQuery' call*
 {'status': '500', 'transfer-encoding': 'chunked', 'set-cookie':
 'JSESSIONID=ECC4905C2D52F7456F4968E2C30D6639; Path=/3diws', 'server':
 'Apache-Coyote/1.1', 'connection': 'close', 'date': 'Wed, 19 Mar 2014
 15:25:26 GMT', 'content-type': 'text/xml;charset=utf-8'}



 Il giorno mercoledì 19 marzo 2014 15:25:45 UTC+1, Mariano Reingart ha
 scritto:

 Could you send me the content of client.response (http headers)?
 Maybe it is returning a cookie or something equivalent
 Then, you can update client.http_headers with them and it should work

 Best regards,

 Mariano Reingart
 http://www.sistemasagiles.com.ar
 http://reingart.blogspot.com


 On Wed, Mar 19, 2014 at 7:40 AM, piero crisci piero@gmail.comwrote:

 Hi mariano i still got some problem
 I solved the problem with the basic authentication but i still have
 some problem on calling webservice.
 The webservice infact need a first call for the db connection ('init' )
 After this call you can call the other services.
 I made this code :

 from pysimplesoap.client import SoapClient
 from pysimplesoap.client import SoapClient, SimpleXMLElement
 location_wsdl =  *http://docway.demo.3di.it
 http://docway.demo.3di.it*/3diws/services/eXtraWayhttp://docway.demo.3di.it/3diws/services/eXtraWay
 
 wsdl =  *http://docway.demo.3di.it/ http://docway.demo.3di.it/*/
 3diws/services/eXtraWay?wsdlhttp://10.55.38.247:8080/3diws/services/eXtraWay?wsdl
 
 namespace_wsdl =  
 *http://docway.demo.3di.it/*http://www.google.com/url?q=http%3A%2F%2Fdocway.demo.3di.it%2F3diws%2Fservices%2FeXtraWay%3Fwsdlsa=Dsntz=1usg=AFQjCNFAe47af7Nlfx1k8KJR8x-hsRTOAg
 3diws/services/eXtraWayhttp://10.55.38.247:8080/3diws/services/eXtraWay
 
 import base64
 username='admin'
 password=''

 auth = base64.b64encode('%s:%s' % (username, password))
 client = SoapClient(location = location_wsdl, wsdl=wsdl,
 *sessions=True,* namespace=namespace_wsdl,
 http_headers={'Authorization': Basic %s % auth},username=username,
 password=password)
 client['AuthHeaderElement'] = {'Authorization': Basic %s % auth}

 client.send('init',xml=xml_init)
 client.send('executeQuery',xml=xml_execute_query)
  When i call the 'executeQuery' i got as response that the connection
 is not established. The connection should be established with the 'Init'
 call .
 I got the same problem with SOAPUI but i managed to solve the problem
 activating the option Maintain HTTP Session
 Even putting sessions = True is not solving the problem
 Thank for help
 Piero

 Il giorno martedì 18 marzo 2014 07:26:35 UTC+1, Mariano Reingart ha
 scritto:

 Hi piero:

 The first choice to connect to a webservice that requires username 
 password (add_credentials), you will httplib2 installed:

 https://code.google.com/p/httplib2

 Then you could do:

 client = SoapClient(location = location_wsdl,sessions=True,us
 ername='admin',password='xx')

 Also, assuming your webservice supports basic auth, you could pass
 the Authentication http header directly (it 

[web2py] Re: Need a instruction for Rating Plugin

2014-03-19 Thread José Leite
Hello, I tried to use this plugin, but the stars are not appearing!!!
Anyone knows what may be the problem?


Sábado, 14 de Janeiro de 2012 6:01:27 UTC, kenji4569 escreveu:

 Thanks for your blog post! 

 On 1月14日, 午前3:55, Omi Chiba ochib...@gmail.com wrote: 
  It easy to use and works great !! 
  
  Here's my blog posthttp://
 ochiba77.blogspot.com/2012/01/web2py-plugin-rating-widget.html 
  
  On Jan 12, 7:08 pm, kenji4569 hos...@s-cubism.jp wrote: 
  
  
  
  
  
  
  
   I made a similar plugin before, and now uploaded it to my plugin site: 
  
  http://dev.s-cubism.com/plugin_rating_widget 
  
   The plugin provide a form widget to generate the rating chooser. 
  
   Just give it a try. 
  
   (Note that the plugin has some boilerplate codes for dealing with ajax 
   form and for customizing css and js files.) 
  
   Kenji 
  
   On 1月13日, 午前4:56, Chris Hawkes chrshawke...@gmail.com wrote: 
  
I did take a look at that myself.   I find it much harder to figure 
 out how to apply a plugin to my design then to just do it all over myself 
 specific to my design.  If you are beginner it will be a nightmare.  You 
 should prabably make your own with simple form variables using jquery and 
 CSS to create roll over effects 
  
Sent from my Samsung smartphone on ATT 
  
Omi Chiba ochib...@gmail.com wrote: 
I'm trying to use the plugin but it doesn't provide me much 
information. 
http://www.web2py.com/plugins/default/rating 
  
Is there anyone who use it and who can provide me a little bit more 
details ?

-- 
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] Pulling data every 30s for a ticker with web2py

2014-03-19 Thread Martin


Le lundi 17 mars 2014 14:21:27 UTC+2, Ramos a écrit :

 does this help?

 http://vimeo.com/27478796


 2014-03-16 17:48 GMT+00:00 Martin kurl...@gmail.com javascript::

 Hi all,
 Please could anyone help me out, I need to pull some data from some API 
 (ex: https//xxx/aaa/ etc.) every 30s and then display the result in a ti
 cker
 How do I do this with Web2py + JavaScript ? I am new to web2py.

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


Thank you Ramos yes it did, but it seems to be a lot of load... i am using 
javascript setInterval and ajax to fetch the result, but it seems to be a 
lot of load... is there any better way to do this??? 

-- 
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] Field.label=lambda ... possible?

2014-03-19 Thread Kiran Subbaraman
Hello,
I am creating a SQLFORM.grid(), and in the update-form for that grid, I 
want to display the label value by computing it.

Basically, I have this:

model:
db.define_table('x',
Field('p', type='string'),
Field('q', type='string')
)


controller:

  if blah:
 db.x.q.label = lambda row: row.p
.


The label is displayed like this 'function lambda at 0x0955FF30'
Not sure if this is supported, or I need to change this code?
Any help?

Thanks,
Kiran

-- 
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: Field.label=lambda ... possible?

2014-03-19 Thread Anthony
The label is used to label an entire column, so it wouldn't make sense to 
calculate a different label for every record. What exactly are you trying 
to do?

On Wednesday, March 19, 2014 2:54:22 PM UTC-4, Kiran Subbaraman wrote:

 Hello,
 I am creating a SQLFORM.grid(), and in the update-form for that grid, I 
 want to display the label value by computing it.

 Basically, I have this:

 model:
 db.define_table('x',
 Field('p', type='string'),
 Field('q', type='string')
 )


 controller:
 
   if blah:
  db.x.q.label = lambda row: row.p
 .


 The label is displayed like this 'function lambda at 0x0955FF30'
 Not sure if this is supported, or I need to change this code?
 Any help?

 Thanks,
 Kiran


-- 
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: Field.label=lambda ... possible?

2014-03-19 Thread Kiran Subbaraman
Thanks, that makes sense.
What am trying to do is this...

*model*
db.define_table('x',
Field('p', type='string'),
Field('q', type='string'),
Field('r', type='text')
)

This will be displayed in a SQLFORM.grid, with the following caveats:

   1. I do not want to see columns for p, q, and r, but rather format the 
   output in such way that p q r are concatenated.Therefore the grid will look 
   like this:
   |--p+q+r value--|--row buttons--|
   2. When I edit the row, the edit form should display:
   p (in readonly mode)
   q (in read/write mode)
   r (is not displayed)


   - For caveat 1, I achieved that with the grid's links={} option to 
   display what I need, in the format I needed it. Something like this links = 
   [{'header':'Custom stuff', 'body':lambda row:  }]. This also means that 
   I set all the fields to readable=False. 
   - For caveat 2, I was trying the stuff mentioned in my original post
   






On Thursday, March 20, 2014 12:51:12 AM UTC+5:30, Anthony wrote:

 The label is used to label an entire column, so it wouldn't make sense to 
 calculate a different label for every record. What exactly are you trying 
 to do?

 On Wednesday, March 19, 2014 2:54:22 PM UTC-4, Kiran Subbaraman wrote:

 Hello,
 I am creating a SQLFORM.grid(), and in the update-form for that grid, I 
 want to display the label value by computing it.

 Basically, I have this:

 model:
 db.define_table('x',
 Field('p', type='string'),
 Field('q', type='string')
 )


 controller:
 
   if blah:
  db.x.q.label = lambda row: row.p
 .


 The label is displayed like this 'function lambda at 0x0955FF30'
 Not sure if this is supported, or I need to change this code?
 Any help?

 Thanks,
 Kiran



-- 
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: Field.label=lambda ... possible?

2014-03-19 Thread Anthony
def mygrid():
if 'edit' in request.args:
db.x.p.writable = False
db.x.r.readable = db.x.r.writable = False
else:
db.x.p.readable = db.x.q.readable = db.x.r.readable = False
return dict(grid=SQLFORM.grid(db.x, ...)


On Wednesday, March 19, 2014 3:41:09 PM UTC-4, Kiran Subbaraman wrote:

 Thanks, that makes sense.
 What am trying to do is this...

 *model*
 db.define_table('x',
 Field('p', type='string'),
 Field('q', type='string'),
 Field('r', type='text')
 )

 This will be displayed in a SQLFORM.grid, with the following caveats:

1. I do not want to see columns for p, q, and r, but rather format the 
output in such way that p q r are concatenated.Therefore the grid will 
 look 
like this:
|--p+q+r value--|--row buttons--|
2. When I edit the row, the edit form should display:
p (in readonly mode)
q (in read/write mode)
r (is not displayed)


- For caveat 1, I achieved that with the grid's links={} option to 
display what I need, in the format I needed it. Something like this links 
 = 
[{'header':'Custom stuff', 'body':lambda row:  }]. This also means 
 that 
I set all the fields to readable=False. 
- For caveat 2, I was trying the stuff mentioned in my original post







 On Thursday, March 20, 2014 12:51:12 AM UTC+5:30, Anthony wrote:

 The label is used to label an entire column, so it wouldn't make sense to 
 calculate a different label for every record. What exactly are you trying 
 to do?

 On Wednesday, March 19, 2014 2:54:22 PM UTC-4, Kiran Subbaraman wrote:

 Hello,
 I am creating a SQLFORM.grid(), and in the update-form for that grid, I 
 want to display the label value by computing it.

 Basically, I have this:

 model:
 db.define_table('x',
 Field('p', type='string'),
 Field('q', type='string')
 )


 controller:
 
   if blah:
  db.x.q.label = lambda row: row.p
 .


 The label is displayed like this 'function lambda at 0x0955FF30'
 Not sure if this is supported, or I need to change this code?
 Any help?

 Thanks,
 Kiran



-- 
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] Re: REF: Downloading static files with spaces gives an error

2014-03-19 Thread Teddy Nyambe
Rocket and will eventually deploy on apache. It will be a link pointing to
a file and when someone clicks should prompt a save
On 19 Mar 2014 17:05, LightDot light...@gmail.com wrote:

 Vital parts of information are missing - are the files served by Rocket ,
 Apache, or..? How is the file being downloaded? By a browser request? How
 is the request formulated, are you following a link or entering the URL by
 typing it directly?

 Regards

 On Wednesday, March 19, 2014 3:24:03 PM UTC+1, software.ted wrote:

 I have trying to download files stored in static/upload/my file.pdf, it
 returns page not found. But when i remove spaces and change the static
 file, it works.

 Any ideas on why this behaviour or explanation?

 --
 
 ...
 Teddy Lubasi Nyambe
 Opensource Zambia

  --
 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] Re: Field.label=lambda ... possible?

2014-03-19 Thread Kiran Subbaraman
Anthony,
Thank you :-)

Kiran

On Thursday, March 20, 2014 1:51:15 AM UTC+5:30, Anthony wrote:

 def mygrid():
 if 'edit' in request.args:
 db.x.p.writable = False
 db.x.r.readable = db.x.r.writable = False
 else:
 db.x.p.readable = db.x.q.readable = db.x.r.readable = False
 return dict(grid=SQLFORM.grid(db.x, ...)


 On Wednesday, March 19, 2014 3:41:09 PM UTC-4, Kiran Subbaraman wrote:

 Thanks, that makes sense.
 What am trying to do is this...

 *model*
 db.define_table('x',
 Field('p', type='string'),
 Field('q', type='string'),
 Field('r', type='text')
 )

 This will be displayed in a SQLFORM.grid, with the following caveats:

1. I do not want to see columns for p, q, and r, but rather format 
the output in such way that p q r are concatenated.Therefore the grid 
 will 
look like this:
|--p+q+r value--|--row buttons--|
2. When I edit the row, the edit form should display:
p (in readonly mode)
q (in read/write mode)
r (is not displayed)


- For caveat 1, I achieved that with the grid's links={} option to 
display what I need, in the format I needed it. Something like this links 
 = 
[{'header':'Custom stuff', 'body':lambda row:  }]. This also means 
 that 
I set all the fields to readable=False. 
- For caveat 2, I was trying the stuff mentioned in my original post







 On Thursday, March 20, 2014 12:51:12 AM UTC+5:30, Anthony wrote:

 The label is used to label an entire column, so it wouldn't make sense 
 to calculate a different label for every record. What exactly are you 
 trying to do?

 On Wednesday, March 19, 2014 2:54:22 PM UTC-4, Kiran Subbaraman wrote:

 Hello,
 I am creating a SQLFORM.grid(), and in the update-form for that grid, I 
 want to display the label value by computing it.

 Basically, I have this:

 model:
 db.define_table('x',
 Field('p', type='string'),
 Field('q', type='string')
 )


 controller:
 
   if blah:
  db.x.q.label = lambda row: row.p
 .


 The label is displayed like this 'function lambda at 0x0955FF30'
 Not sure if this is supported, or I need to change this code?
 Any help?

 Thanks,
 Kiran



-- 
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: howto: ajax call in FORM with signed URL

2014-03-19 Thread Niphlod
you're missing a point: separation of what is executed by python and what 
is executed by javascript.

user_signature takes into consideration a/c/f , args AND vars.

your URL link in the onkeyup attribute is generated by python, but then 
ajax() takes the values presented in the form (in your case, while the user 
is typing values) and post those to the original URL (as vars).

python can't know in advance what values the user will type, and javascript 
(ajax()) can't sign the resulting url because of two things:
- it doesn't know what hmac_key to use ('cause only the server knows what 
is it, that's the whole point of user_signature)
- it doesn't know HOW to create the signature

If you need signed URLs, you need to verify the url without taking vars 
into consideration. 
Please review the book about the signature process...
http://web2py.com/books/default/chapter/29/04/the-core?search=signed#Digitally-signed-urls

BTW: auth.requires_signature() takes hash_vars as a parameter too.

On Wednesday, March 19, 2014 10:18:38 PM UTC+1, Mike Constabel wrote:

 Doesn't work. The generated HTML code:

 input id=keyword name=keyword onkeyup=ajax(URL(#x27;callback#x27;, 
 [#x27;keyword#x27;, #x27;stype#x27;], user_signature=True), 
 #x27;target#x27;); type=text /



 Am Mittwoch, 19. März 2014 16:31:41 UTC+1 schrieb LightDot:

 Try:

 TD(INPUT(_id='keyword', _name='keyword', _onkeyup=ajax(URL('callback', 
 ['keyword', 'stype'], user_signature=True), 'target');), _name=
 search_type)))

 Regards

 On Wednesday, March 19, 2014 1:59:38 PM UTC+1, Mike Constabel wrote:

 Hi,

 in a form i have

 TD(INPUT(_id='keyword', _name='keyword', _onkeyup=ajax(URL('callback', 
 ['keyword', 'stype']), 'target');), _name=search_type)))

 If a text is entered, callback is called an some text is displayed in 
 target. This works.

 But now I want to sign the URL.

 If I add @auth.requires_signature() to callback function, it no longer 
 works. The ajax call must be signed.

 @auth.requires_signature()
 def callback():
 return P(foo)

 But how can I add user_signature=True to the code above so that the 
 ajax call will be signed?

 Regards,
 Mike



-- 
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: howto: ajax call in FORM with signed URL

2014-03-19 Thread Mike Constabel
Doesn't work. The generated HTML code:

input id=keyword name=keyword onkeyup=ajax(URL(#x27;callback#x27;, 
[#x27;keyword#x27;, #x27;stype#x27;], user_signature=True), 
#x27;target#x27;); type=text /



Am Mittwoch, 19. März 2014 16:31:41 UTC+1 schrieb LightDot:

 Try:

 TD(INPUT(_id='keyword', _name='keyword', _onkeyup=ajax(URL('callback', 
 ['keyword', 'stype'], user_signature=True), 'target');), _name=
 search_type)))

 Regards

 On Wednesday, March 19, 2014 1:59:38 PM UTC+1, Mike Constabel wrote:

 Hi,

 in a form i have

 TD(INPUT(_id='keyword', _name='keyword', _onkeyup=ajax(URL('callback', 
 ['keyword', 'stype']), 'target');), _name=search_type)))

 If a text is entered, callback is called an some text is displayed in 
 target. This works.

 But now I want to sign the URL.

 If I add @auth.requires_signature() to callback function, it no longer 
 works. The ajax call must be signed.

 @auth.requires_signature()
 def callback():
 return P(foo)

 But how can I add user_signature=True to the code above so that the 
 ajax call will be signed?

 Regards,
 Mike



-- 
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: howto: ajax call in FORM with signed URL

2014-03-19 Thread Mike Constabel
This is logical for me. Thank you for the explanation.

I read the book often, especially the ajax part. I found this sentence: It 
is good practice to always digitally sign Ajax callbacks.

Now I ask me:
Is it possible to sign the url and exclude keyword and stype? So that a 
user can't submit other vars?

In the book is an example with LOAD, this I understand.

But for ajax in my case it seems now to be impossible to sign it. I have no 
idea.

I think I must take ajax callback as potentially insecure and handle this 
accordingly.

Am Mittwoch, 19. März 2014 22:37:33 UTC+1 schrieb Niphlod:

 you're missing a point: separation of what is executed by python and what 
 is executed by javascript.

 user_signature takes into consideration a/c/f , args AND vars.

 your URL link in the onkeyup attribute is generated by python, but then 
 ajax() takes the values presented in the form (in your case, while the user 
 is typing values) and post those to the original URL (as vars).

 python can't know in advance what values the user will type, and 
 javascript (ajax()) can't sign the resulting url because of two things:
 - it doesn't know what hmac_key to use ('cause only the server knows what 
 is it, that's the whole point of user_signature)
 - it doesn't know HOW to create the signature

 If you need signed URLs, you need to verify the url without taking vars 
 into consideration. 
 Please review the book about the signature process...

 http://web2py.com/books/default/chapter/29/04/the-core?search=signed#Digitally-signed-urls

 BTW: auth.requires_signature() takes hash_vars as a parameter too.

 On Wednesday, March 19, 2014 10:18:38 PM UTC+1, Mike Constabel wrote:

 Doesn't work. The generated HTML code:

 input id=keyword name=keyword onkeyup=ajax(URL(#x27;callback#x27;, 
 [#x27;keyword#x27;, #x27;stype#x27;], user_signature=True), 
 #x27;target#x27;); type=text /



 Am Mittwoch, 19. März 2014 16:31:41 UTC+1 schrieb LightDot:

 Try:

 TD(INPUT(_id='keyword', _name='keyword', _onkeyup=ajax(URL('callback', 
 ['keyword', 'stype'], user_signature=True), 'target');), _name=
 search_type)))

 Regards

 On Wednesday, March 19, 2014 1:59:38 PM UTC+1, Mike Constabel wrote:

 Hi,

 in a form i have

 TD(INPUT(_id='keyword', _name='keyword', _onkeyup=ajax(URL('callback', 
 ['keyword', 'stype']), 'target');), _name=search_type)))

 If a text is entered, callback is called an some text is displayed in 
 target. This works.

 But now I want to sign the URL.

 If I add @auth.requires_signature() to callback function, it no longer 
 works. The ajax call must be signed.

 @auth.requires_signature()
 def callback():
 return P(foo)

 But how can I add user_signature=True to the code above so that the 
 ajax call will be signed?

 Regards,
 Mike



-- 
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] bug in dal.py _select geoexpand: convert geography as well

2014-03-19 Thread sunny
geoexpand should expand geography as well.
otherwise geography fields will not be converted to text.

the fix for me was to change the if part in geoexpand (dal.py:1713)

-if isinstance(field.type,str) and 
field.type.startswith('geometry') and isinstance(field, Field):

+if isinstance(field.type,str) and field.type.startswith('geo') 
and isinstance(field, Field):



-- 
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: Database access without DAL but with connection pool

2014-03-19 Thread Derek
I'd say the answer to 2 is 'not really'. Believe it or not, opening and 
dropping database connections is a fast operation.

On Tuesday, March 18, 2014 11:33:04 PM UTC-7, tec...@gmail.com wrote:

 Dear Sirs,


 I understand it's possible to use databases without DAL.
 For example function in controller:

 def values():
 client = pymongo.MongoClient('localhost', 27017)
 db = client.mybase
 mytable = db[mytable]
 res = mytable.find()
 .

 return dict()

 And of course it works.
 But is it fast to connect/disconnect every time in function? What's about 
 connection pool?
 I consider connection pool could increase access to database. 

 1. Actually I would like to ask how to access to database without DAL but 
 at maximum speed?
 2. Do I need connection pool for fast database access? (I think, yes.)
 3. How could I build custom connection pool for database access without 
 DAL? Or any solution to re-use connections to database server? Any examples?



 Andrey A.


-- 
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] 504 Gateway Time-out

2014-03-19 Thread António Ramos
2014-03-19 12:24 GMT+00:00 Johann Spies johann.sp...@gmail.com:

 uwsgi_read_timeout


sorry my ignorance ,
where do i do that?

-- 
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] pytds support for mssql?

2014-03-19 Thread Derek
Back in November, niphlod (?sp) said that he'd look into adding pytds 
support to DAL. I didn't have a chance to look a lot at pytds until 
recently, I don't see that it's supported yet. I believe the only thing 
missing from pytds to be able to add support is the DSN connection syntax. 
If anyone is interested, I could do a pull request and see if we can get 
that incorporated into pytds. I just reported a few issues with it and 
those were fixed (related to transactions on sql 2000), so I think it's 
mature enough to add. If anyone wants to add it to the DAL, I can offer my 
support as far as testing and workarounds for some issues it may have (its 
DBAPI 2.0 support is a little wonky).

Why PyTDS? You get MS SQL Server support with 0 binaries required on the 
host, it's 100% pure python (well, you'd benefit from bitarray, but it's 
not required). It doesn't use ODBC or anything, just straight TCP. That 
also means that you could run this with greenlets without reverting to 
seralized operations. The current pyodbc and pypyodbc still use the 
platform's odbc drivers which are written in C.

-- 
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] Pulling data every 30s for a ticker with web2py

2014-03-19 Thread Derek
What do you mean it's a lot of load? Is the UI freezing while it's loading, 
or is something else happening?

On Wednesday, March 19, 2014 7:28:51 AM UTC-7, Martin wrote:



 Le lundi 17 mars 2014 14:21:27 UTC+2, Ramos a écrit :

 does this help?

 http://vimeo.com/27478796


 2014-03-16 17:48 GMT+00:00 Martin kurl...@gmail.com:

 Hi all,
 Please could anyone help me out, I need to pull some data from some API 
 (ex: https//xxx/aaa/ etc.) every 30s and then display the result in a ti
 cker
 How do I do this with Web2py + JavaScript ? I am new to web2py.

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


 Thank you Ramos yes it did, but it seems to be a lot of load... i am using 
 javascript setInterval and ajax to fetch the result, but it seems to be a 
 lot of load... is there any better way to do this??? 


-- 
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: Pulling data every 30s for a ticker with web2py

2014-03-19 Thread Derek
If you are pulling data from another web service, take a look at the cache 
function built into web2py. Use that to get the api results and it will 
cache the results. Any time the results are requested, if they are older 
than the expiration time, they will force a reload. The only issue with 
doing it this way is your server may slowdown while this is going on, so 
you may want to disable sessions for this particular function call.

On Sunday, March 16, 2014 10:48:11 AM UTC-7, Martin wrote:

 Hi all,
 Please could anyone help me out, I need to pull some data from some API 
 (ex: https//xxx/aaa/ etc.) every 30s and then display the result in a ti
 cker
 How do I do this with Web2py + JavaScript ? I am new to web2py.

 Thank you.


-- 
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] Python Performance Issue, Part 2

2014-03-19 Thread Tim Richardson
Try threads = 30 or 50 or 100; that would be interesting.

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