[web2py] Re: How can I access functions from multiple files in the controllers directory?

2016-11-03 Thread 黄祥
i think you can pass the parameter to the modules
*e.g.*
*controllers/default.py*
def test():
table = db.test
return test.grid_0(table)

*modules/test.py*
from gluon import *

def grid_0(table):
grid = SQLFORM.grid(table)
return locals()

another way is access the dal directly from modules with current
*e.g.*
*controllers/default.py*
def test():
time_stamp = request.now
client_ip = request.client
user_id = auth.user_id
origin = '%s/%s' % (request.controller, request.function)
description = 'test'
return test.insert_table_event(time_stamp, client_ip, user_id, origin, 
description)

*modules/test.py*
from gluon import *

def insert_table_event(time_stamp, client_ip, user_id, origin, description):
current.db.auth_event.insert(time_stamp = time_stamp, 
client_ip = client_ip, 
user_id = user_id, 
origin = origin, 
description = description)
current.db.commit()

thanks and best regards,
stifan

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: How can I access functions from multiple files in the controllers directory?

2016-11-03 Thread 'tomt' via web2py-users
Hi,
Thanks for your reply.  I tried using modules as you suggested.  It works 
great for simple python functions, but when I try to use DAL it dies.  It 
appears that functions in modules aren't aware of the model definitions.  
Chapter 4 of the manual indicates that I could probably do this by 
importing exec_environment but I think I will just put my DAL code back in 
controllers/default.py.

- Tom

On Tuesday, November 1, 2016 at 10:03:30 PM UTC-6, 黄祥 wrote:
>
> just an idea why not put it on modules?
> e.g.
> *controllers/default.py*
> import file1
>
> a = file1.function1(x, y)
> b = file1.function2(y, z)
>
> *modules/file1.py*
> def function1(value1, value2):
> code
> return
> 
> def function2(value1, value2):
> code
> return
>
> best regards,
> stifan
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] form error: duplicate field in table no_table

2016-11-03 Thread Alex Glaros
I think this error arises when two tables in factory have same field name. 
I usually get around this by naming one of the fields differently, but best 
practice is to name same foreign key identically in all tables it is used 
in.

Any better way to prevent this error?

thanks

Alex Glaros


 duplicate field organization_FK in table 
no_tableVersion
web2py™ Version 2.14.6-stable+timestamp.2016.05.10.00.21.47
Python Python 2.7.9: C:\alex\alt_web2py_6\web2py\web2py.exe (prefix: )
Traceback

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.

Traceback (most recent call last):
  File "C:\alex\alt_web2py_6\web2py\gluon\restricted.py", line 227, in 
restricted
exec ccode in environment
  File "C:/alex/alt_web2py_6/web2py/applications/ES3/controllers/default.py" 
, line 
11052, in 
  File "C:\alex\alt_web2py_6\web2py\gluon\globals.py", line 417, in 
self._caller = lambda f: f()
  File "C:\alex\alt_web2py_6\web2py\gluon\tools.py", line 4241, in f
return action(*a, **b)
  File "C:/alex/alt_web2py_6/web2py/applications/ES3/controllers/default.py" 
, line 
4661, in view_specific_meeting
form_add_new_meeting_segment = SQLFORM.factory(db.SuperObject, 
db.meeting_segment, db.auth_membership)
  File "C:\alex\alt_web2py_6\web2py\gluon\sqlhtml.py", line 1808, in factory
return SQLFORM(DAL(None).define_table(table_name, *fields),
  File "C:\alex\alt_web2py_6\web2py\gluon\packages\dal\pydal\base.py", line 
834, in define_table
table = self.lazy_define_table(tablename,*fields,**args)
  File "C:\alex\alt_web2py_6\web2py\gluon\packages\dal\pydal\base.py", line 
851, in lazy_define_table
table = table_class(self, tablename, *fields, **args)
  File "C:\alex\alt_web2py_6\web2py\gluon\packages\dal\pydal\objects.py", line 
334, in __init__
raise SyntaxError("duplicate field %s in table %s" % (field_name, 
tablename))
SyntaxError: duplicate field organization_FK in table no_table

Error snapshot [image: help] 


(duplicate field organization_FK in table 
no_table)

-- 
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: Push Notifications

2016-11-03 Thread David
I read your link, Anthony. Based off of your link, a few other pages linked 
from your link, and a couple of Google searches I can see that sqlite is small 
time(unless you tweak it) and I'll definitely need to switch my db eventually.

Thanks for both of you guys time.

-- 
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: Push Notifications

2016-11-03 Thread Anthony
On Thursday, November 3, 2016 at 3:51:16 PM UTC-4, Dave S wrote:
>
>
> With this mechanism, you'd spawn a web worker  to do jquery/ajax to check 
>>> when it was time to replace the content.  A couple of the examples 
>>> calculate Pi, and paste the results into the main page.
>>>
>>
>> This approach is "short polling" (i.e., polling the server with quick 
>> requests at some interval to check for updates). Note, there is no 
>> particular reason this must be done with a web worker -- you can simply do 
>> it from the main web page, as it has been done since long before web 
>> workers existed. 
>>
>
> The idea I was applying was keeping the main page quiet, although Google 
> News has used refresh interval to update the entire main page.
> Web workers give you a thicker curtain to draw over the checkers, than 
> does a LOAD/jquery/ajax in a timer loop on the main page.
>

Understood. Just wanted to make it clear that the short-polling approach 
does not *require* the added complication of web workers.

Anthony

-- 
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] convert request.vars to set default value in a custom .factory() form

2016-11-03 Thread Anthony
On Thursday, November 3, 2016 at 4:10:04 PM UTC-4, Richard wrote:
>
> I can show you privately...
>

Or maybe create a simplified example that demonstrates the problem.

-- 
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: Push Notifications

2016-11-03 Thread Anthony
On Thursday, November 3, 2016 at 3:48:29 PM UTC-4, David wrote:
>
> Thanks for such a thorough response, Anthony!
>
> Long polling seems to be the way to go for my website. I've been reading 
> up on the tornado web socket  all day. 
>
> I'm nearing 100 users on my website and i believe that speed will be a 
> problem eventually. I'm deployed to python anywhere like you suggested; 
> however, i am using sqlite still. As of now, everything is working and i've 
> received no complaints on performance. Will there be a problem with long 
> polling while using sqlite?
>

Use of long-polling/websockets will not affect the database. You just have 
to worry about how many reads and writes you are doing. You might get away 
with SQLite for quite a while -- see https://sqlite.org/whentouse.html.

Anthony

-- 
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: scheduler creates "zombie" processes

2016-11-03 Thread Niphlod
Got that. Thanks for explaining your POV. What I was trying to say is that 
without being able to reproduce, I can only guess. And since the scheduler 
code in regards of process handling is quite streamlined, there are not a 
lot of places where a zombie can be created.
So, let's guess...

Are zombie processes "still running and churning data" or just leftovers ? 
Usually there are two kinds of zombie processes: completely detached 
processes running and consuming resources (what theoretically the scheduler 
should avoid at all costs) and simple leftovers on the "virtual" process 
table that are there because nobody (the parent process, usually) reclaimed 
either their output or their status code. The second is something to avoid, 
of course, but shouldn't hurt the functionality of the app.

from the pstree you posted, it seems that (shorting code here and there)

p = multiprocessing.Process(executor, )
p.start()
try:
#task runs
p.join(run_timeout)
except:
#this should be raised only when a general error on the task happened, 
so it's a STOPPED one
p.terminate()
p.join()
else:
#this is the codepath your task takes, since its the one landing 
TIMEOUT tasks
if p.is_alive():
 # this is ultimately the call that SHOULD kill the process you 
later find as a zombie
 p.terminate()
 

this "terminate" is labelled as using SIGKILL on the process. Eventual 
processes child of that one (i.e. a subprocess call inside the task itself) 
are not guaranteed to be terminated, but then they'll show as orphaned, 
while your pstree reports python processes still "attached" to the 
scheduler worker process. 

>From where I stand, if the result is the task being labelled as TIMEOUT 
(with the corresponding "task timeout" debug line), it can only be 
originated there.
Maybe there's a culprit there can you add a p.join() after that 
p.terminate(), and maybe a few debug lines ? 
i.e.


... else:
if p.is_alive():
logger.debug(' MD: terminating')
p.terminate()
logger.debug(' MD: terminated')
logger.debug(' MD: joining')
p.join()
logger.debug(' MD: joined')
logger.debug(' task timeout')
try:
# we try to get a traceback here
tr = queue.get(timeout=2)
...




-- 
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] convert request.vars to set default value in a custom .factory() form

2016-11-03 Thread Richard Vézina
I can show you privately...

Richard

On Thu, Nov 3, 2016 at 12:13 PM, Anthony  wrote:

> Can you show your code? It is not clear why you can't use the "keepvalues"
> argument. Please explain the workflow in more detail.
>
>
> On Tuesday, November 1, 2016 at 10:45:45 AM UTC-4, Richard wrote:
>>
>> Hello,
>>
>> I have an high customized SQLFORM.factory() form... I set default value
>> for the update form for which I have no problem with values types as they
>> get out of the database... But in case I want to emulate keepvalue feature
>> with this form I need to pass value to request.vars which I need to set as
>> default... The problem is that all value are string when I get them and I
>> need to populate many fields and would greatly prefer not have to handle
>> each fields manually one by one but instead do it dynamically so if I had
>> field to the table I don't have to add it... So I am searching a way to
>> convert appropriately value for each field type... I could use the approach
>> proposed in the answer accepted hear : http://stackoverflow.com/que
>> stions/7402573/use-type-information-to-cast-values-stored-as-strings
>>
>> I there surely such a thing in the web2py internal... I thought
>> _filter_fields() would do it, but it only filter field that are member of a
>> table, it doesn't act over the value of the field... I thought of using
>> requires/validator, but I am not sure how to use them.
>>
>> Thanks
>>
>> Richard
>>
>>
>>
>> --
> 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] Re: web2py for windows server. IIS or Nginx?

2016-11-03 Thread Niphlod
IIS and ISAPI --> helicon ? AFAIK it was the "old" standard.
When Azure eventually moved to support python web apps, smart guys at MS 
implemented the - until that moment - missing link to run natively a 
fastcgi python process speaking with IIS through the "same interface" that 
runs any other fastcgi-enabled language (e.g. PHP), which is the 
wfastcgi.py module/script. 
I'd go for the "newly and improved" rather than having a 3rd party 
integrated with ISAPI: less moving parts, better support moving forward as 
it's "100%" MS supported code.

On Thursday, November 3, 2016 at 12:45:36 AM UTC+1, Pbop wrote:
>
> We built a SHIB SSO and OAUTH SSO middleware in web2py that handles 1000+ 
> concurrent users with very good results in IIS and ISAPI running a WSGI 
> wrapper ala the cookbook instructions. I hear IIS and FastCGI and wonder if 
> this is a better deployment option? Are you aware of any advantages of one 
> over the other?
>
> On Wednesday, November 2, 2016 at 5:55:36 PM UTC-4, Niphlod wrote:
>>
>> it's from some time ago but should work without issues. I think some 
>> improvements have been made regarding wfastcgi availability as a proper 
>> package, but in any case, I'm here to help (and maybe we can revisit the 
>> segment on the book with your experience).
>>
>> : should be "verbatim" but improvements on MS side could have 
>> changed little bits. 
>>
>> On Wednesday, November 2, 2016 at 2:09:07 PM UTC+1, Omi Chiba wrote:
>>>
>>> OK! I failed last time but it worth try again. I will follow the book 
>>> try it later.
>>>
>>> http://www.web2py.com/books/default/chapter/29/13/deployment-recipes?search=iis#IIS
>>>
>>> On Wednesday, November 2, 2016 at 3:43:37 AM UTC-5, Niphlod wrote:

 *nix --> nginx with uwsgi
 windows --> iis with fastcgi


 BTW: iis is perfectly fine running production envs. And it's NOT 
 difficult.


 On Tuesday, November 1, 2016 at 8:01:22 PM UTC+1, Omi Chiba wrote:
>
> Thank you! I will stick to Apache/wsgi for now. 
>
> On Tuesday, November 1, 2016 at 1:54:37 PM UTC-5, Jim S wrote:
>>
>> I think the thread you referenced was one discussing deployment on 
>> Ubuntu where yes, nginx/uwsgi is preferred.  But, the Windows 
>> environment 
>> is different (in my opinion) since the Windows nginx is still considered 
>> 'beta'.   I wouldn't feel that comfortable using it.  (that said, I do 
>> use 
>> many other 'beta' projects)
>>
>> If Apache/mod_wsgi is really frowned upon, should it be noted in the 
>> book?
>>
>> @omi - I migrated from Windows/Apache/mod_wsgi a while back to 
>> Ubuntu/nginx/uwsgi.  I think that at that time I switched from using 
>> pyodbc 
>> to pypyodbc.  I too access MS SQL servers from my ubuntu box using ODBC 
>> (along with IBM AS/400 databases).  It works very well for me.
>>
>> -Jim
>>
>>
>> On Tuesday, November 1, 2016 at 1:33:53 PM UTC-5, Richard wrote:
>>>
>>> I would say, we don't not don't support it, we just don't maintain a 
>>> web2py setup script with Apache... I think the decision was to reduce 
>>> the 
>>> number of setup script to the bare minium to only the one web2py-devs 
>>> are 
>>> willing to maintain...
>>>
>>> That been said, I am sure that if you or someone else take owner 
>>> ship to update and maintain Apache setup script because it important 
>>> for 
>>> you we will bring it back in the scripts folder... But I wouldn't take 
>>> that 
>>> path before someone demonstrate commitment to the task as we don't want 
>>> to 
>>> get back stuff that will not be maintain in years in the repo... I 
>>> guess 
>>> you can set your own github repo to demonstrate your commitment and 
>>> help 
>>> the community though, and it could be reference somewhere appropriate 
>>> in 
>>> the book.
>>>
>>> Richard
>>>
>>> On Tue, Nov 1, 2016 at 2:22 PM, Dave S  wrote:
>>>


 On Tuesday, November 1, 2016 at 7:51:26 AM UTC-7, Omi Chiba wrote:
>
> Thank you. I thought the Massimo's comment below and he  also 
> mentioned somewhere we don't want to support Apache anymore... that's 
> why I 
> was nervous. I was thinking to your direction (Moving to Ubuntu) but 
> I use 
> pyodbc to connect Microsoft SQL Server and DB2, also python-ldap.. so 
> not 
> sure if it works the same way.
>
>
> "P.S. I stand by Niphlod. He did not say anything offending and 
> his comment was insightful. We do not recommend apache+mod_wsgi 
> because 
> there are better ways (nginx+uwsgi)."
>
>
 If you have a working Apache configuration, that's an argument for 
 staying with it [caveats follow].  Part of the deprecating is 

[web2py] Re: Push Notifications

2016-11-03 Thread Dave S


On Wednesday, November 2, 2016 at 7:37:52 PM UTC-7, Anthony wrote:
>
> On Wednesday, November 2, 2016 at 7:52:05 PM UTC-4, Dave S wrote:
>>
>> There are 2 mechanism in HTML5, I believe, but I'm only going to point 
>> you at one for the moment:  Web Workers.
>> > http://www.htmlgoodies.com/html5/javascript/working-with-web-workers-in-html5-powered-web-pages.html
>> >
>> > http://www.htmlgoodies.com/HTML5/client/introduction-to-html5-web-workers-the-javascript-multi-threading-approach.html
>> >
>> > http://www.htmlgoodies.com/html5/other/html5-tech-shared-web-workers-help-spread-the-news.html
>> >
>>
>> With this mechanism, you'd spawn a web worker  to do jquery/ajax to check 
>> when it was time to replace the content.  A couple of the examples 
>> calculate Pi, and paste the results into the main page.
>>
>
> This approach is "short polling" (i.e., polling the server with quick 
> requests at some interval to check for updates). Note, there is no 
> particular reason this must be done with a web worker -- you can simply do 
> it from the main web page, as it has been done since long before web 
> workers existed. 
>

The idea I was applying was keeping the main page quiet, although Google 
News has used refresh interval to update the entire main page.
Web workers give you a thicker curtain to draw over the checkers, than does 
a LOAD/jquery/ajax in a timer loop on the main page.
 

> The idea is simply to keep making Ajax requests at regular intervals 
> (e.g., every second). This approach might be fine, though depending on how 
> many users are connected and how frequently they are checking, the server 
> could get overwhelmed with requests. To reduce the load, you can decrease 
> the request frequency, but then you increase the average latency between 
> when a message is sent and when the recipient receives it.
>  
>
>> There is also web sockets in HTML5.
>> > http://www.htmlgoodies.com/html5/tutorials/making-html5-websockets-work.html
>> >
>> Gluon/contrib has websocket_messaging.py.
>>
>
> To handle the shortcomings of "short polling", you can instead use 
> websockets (or long-polling, which maintains a long-held HTTP connection 
> with the server until a new message is received). However, you need a web 
> server and application that can handle many long-held open connections. To 
> address this need, web2py includes websocket_messaging.py, as noted above 
> -- it makes use of the Tornado web server to handle the websocket 
> connections. You can also use various realtime messaging services (e.g., 
> Fanout ), or something like Pushpin 
>  (an open source proxy server used by Fanout), which 
> is probably a bit more robust and full-featured than websocket_messaging.py.
>
> Anthony
>

Thanks for the additional pointers.
 

/dps
 

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Push Notifications

2016-11-03 Thread Jaimee S
Thanks for such a thorough response, Anthony!

Long polling seems to be the way to go for my website. I've been reading up 
on the tornado web socket  all day. 

I'm nearing 100 users on my website and i believe that speed will be a 
problem eventually. I'm deployed to python anywhere like you suggested; 
however, i am using sqlite still. As of now, everything is working and i've 
received no complaints on performance. Will there be a problem with long 
polling while using sqlite?

On Wednesday, November 2, 2016 at 9:37:52 PM UTC-5, Anthony wrote:
>
> On Wednesday, November 2, 2016 at 7:52:05 PM UTC-4, Dave S wrote:
>>
>> There are 2 mechanism in HTML5, I believe, but I'm only going to point 
>> you at one for the moment:  Web Workers.
>> > http://www.htmlgoodies.com/html5/javascript/working-with-web-workers-in-html5-powered-web-pages.html
>> >
>> > http://www.htmlgoodies.com/HTML5/client/introduction-to-html5-web-workers-the-javascript-multi-threading-approach.html
>> >
>> > http://www.htmlgoodies.com/html5/other/html5-tech-shared-web-workers-help-spread-the-news.html
>> >
>>
>> With this mechanism, you'd spawn a web worker  to do jquery/ajax to check 
>> when it was time to replace the content.  A couple of the examples 
>> calculate Pi, and paste the results into the main page.
>>
>
> This approach is "short polling" (i.e., polling the server with quick 
> requests at some interval to check for updates). Note, there is no 
> particular reason this must be done with a web worker -- you can simply do 
> it from the main web page, as it has been done since long before web 
> workers existed. The idea is simply to keep making Ajax requests at regular 
> intervals (e.g., every second). This approach might be fine, though 
> depending on how many users are connected and how frequently they are 
> checking, the server could get overwhelmed with requests. To reduce the 
> load, you can decrease the request frequency, but then you increase the 
> average latency between when a message is sent and when the recipient 
> receives it.
>  
>
>> There is also web sockets in HTML5.
>> > http://www.htmlgoodies.com/html5/tutorials/making-html5-websockets-work.html
>> >
>> Gluon/contrib has websocket_messaging.py.
>>
>
> To handle the shortcomings of "short polling", you can instead use 
> websockets (or long-polling, which maintains a long-held HTTP connection 
> with the server until a new message is received). However, you need a web 
> server and application that can handle many long-held open connections. To 
> address this need, web2py includes websocket_messaging.py, as noted above 
> -- it makes use of the Tornado web server to handle the websocket 
> connections. You can also use various realtime messaging services (e.g., 
> Fanout ), or something like Pushpin 
>  (an open source proxy server used by Fanout), which 
> is probably a bit more robust and full-featured than websocket_messaging.py.
>
> Anthony
>

-- 
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] .git file in gluon/packages/dal/.git

2016-11-03 Thread Niphlod
ok, now it's clear. probably a packaging error on mdipierro's side.

On Thursday, November 3, 2016 at 2:48:45 PM UTC+1, Giles Thomas wrote:
>
> @Niphlod -- the confusing thing for me is that the .git file is present in 
> the source download from the web2py website.  It makes perfect sense that 
> it's present when you do a git checkout, but not when you've downloaded a 
> zip file.
>
>
> All the best,
>
> Giles
>
>
> On Wednesday, 2 November 2016 11:02:18 UTC, Niphlod wrote:
>>
>> uhm ... what ?
>>
>> On Tuesday, November 1, 2016 at 7:10:16 PM UTC+1, Richard wrote:
>>>
>>> I agree with you Simone, but should it stay there in the build for pydal 
>>> only?
>>>
>>> Richard
>>>
>>> On Tue, Nov 1, 2016 at 1:45 PM, Niphlod  wrote:
>>>
 it's perfectly normal as pydal is a subrepo (it's in the readme, too)


 On Tuesday, November 1, 2016 at 5:43:44 PM UTC+1, Giles Thomas wrote:
>
> Thanks, Richard.  
>
> Regarding why -- I'm talking about the version that will be installed 
> by default when someone creates a web2py app on the hosting platform my 
> company provides, PythonAnywhere -- which would also affect the version 
> used by the "Try it now online" link on the front page of 
> www.web2py.com.  I agree that doing version control the web2py way is 
> probably more sensible than making the whole web2py folder a git repo, 
> but 
> if people do want to follow the git route, it would be better if we 
> didn't 
> have that "trap" in there for them :-)
>
>
> All the best,
>
> Giles
>
>
> On Tuesday, 1 November 2016 16:13:22 UTC, Richard wrote:
>>
>> Sorry, you right in there is gluon/packages/dal/.git, I thought you 
>> were speaking of a .git/ folder at the root of web2py which there is 
>> not...
>>
>> I guess you can delete it if it cause problem, but if you have issue 
>> with it, it means you try to init you git repo over the entire web2py 
>> folder?
>>
>> Why don't you just version control your app? which is what we usually 
>> do...
>>
>> Thanks
>>
>> Richard
>>
>> On Tue, Nov 1, 2016 at 10:51 AM, Giles Thomas  
>> wrote:
>>
>>> The one labelled "For normal users", so presumably stable.  The 
>>> VERSION file says:
>>>
>>> Version 2.14.6-stable+timestamp.2016.05.10.00.21.47
>>>
>>>
>>> All the best,
>>>
>>> Giles
>>>
>>> On Tuesday, 1 November 2016 14:48:03 UTC, Richard wrote:

 Nightly or stable? I don't have it in my last build 2.14.6 I 
 think... 

 Richard

 On Tue, Nov 1, 2016 at 10:42 AM, Giles Thomas  
 wrote:

> This is in a download from web2py.com -- specifically, the 
> "Source code" download from 
> http://www.web2py.com/init/default/download.
>
> Interestingly, gluon/packages/dal/.git is a file rather than a 
> directory.  It contains this:
>
> gitdir: ../../../.git/modules/gluon/packages/dal
>
>
>
> All the best,
>
> Giles
>
>
>
>
> On Tuesday, 1 November 2016 13:25:51 UTC, Richard wrote:
>>
>> Do you download from Github or web2py.com? The later you 
>> shouldn't have this issue... If you get web2py from git, it normal 
>> that you 
>> have .git/ for web2py and for dal as dal have been extract from 
>> web2py and 
>> is a project of it own so it is include in the web2py repository as 
>> a 
>> submodule.
>>
>> Richard
>>
>> On Tue, Nov 1, 2016 at 8:50 AM, Giles Thomas > > wrote:
>>
>>> Hi all,
>>>
>>> Someone pointed out to us that web2py has a .git file in 
>>> gluon/packages/dal/.git.  This can cause errors when you try to 
>>> initialize 
>>> your project as a git repo.  Is there a specific reason for it to 
>>> be 
>>> there?  Or is it an artefact of the packaging procedure?  We're 
>>> considering 
>>> removing it from the source that we install for users on 
>>> PythonAnywhere, 
>>> but wanted to check first to make sure that we're not going to 
>>> break 
>>> anything or cause problems for our users.
>>>
>>>
>>> All the best,
>>>
>>> Giles
>>> -- 
>>> Giles Thomas 
>>>
>>> PythonAnywhere: Develop and host Python from your browser
>>> 
>>>
>>> A product from PythonAnywhere LLP
>>> 17a Clerkenwell Road, London EC1M 5RD, UK
>>> VAT No.: GB 893 5643 79
>>> Registered 

Re: [web2py] convert request.vars to set default value in a custom .factory() form

2016-11-03 Thread Anthony
Can you show your code? It is not clear why you can't use the "keepvalues" 
argument. Please explain the workflow in more detail.

On Tuesday, November 1, 2016 at 10:45:45 AM UTC-4, Richard wrote:
>
> Hello,
>
> I have an high customized SQLFORM.factory() form... I set default value 
> for the update form for which I have no problem with values types as they 
> get out of the database... But in case I want to emulate keepvalue feature 
> with this form I need to pass value to request.vars which I need to set as 
> default... The problem is that all value are string when I get them and I 
> need to populate many fields and would greatly prefer not have to handle 
> each fields manually one by one but instead do it dynamically so if I had 
> field to the table I don't have to add it... So I am searching a way to 
> convert appropriately value for each field type... I could use the approach 
> proposed in the answer accepted hear : 
> http://stackoverflow.com/questions/7402573/use-type-information-to-cast-values-stored-as-strings
>
> I there surely such a thing in the web2py internal... I thought 
> _filter_fields() would do it, but it only filter field that are member of a 
> table, it doesn't act over the value of the field... I thought of using 
> requires/validator, but I am not sure how to use them.
>
> Thanks
>
> Richard
>
>
>
>

-- 
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] convert request.vars to set default value in a custom .factory() form

2016-11-03 Thread Richard Vézina
The above not handle bool correctly :

def controller_func():
...
field_type_mapping = \
 {'id': 'int',
  'reference': 'int',
  'boolean': 'bool',
  'string': 'str',
  'decimal': 'decimal',
  'date': 'date',
  'datetime': 'datetime'}

for f in table_name_fields:
if db.table_name[f].type.split('(')[0] == 'decimal':
field_type = field_type_mapping['decimal']
elif db.table_name[f].type.split(' ')[0] == 'reference':
field_type = field_type_mapping['reference']
else:
field_type = field_type_mapping[db.table_name[f].type]
if f in request.vars:
db.table_name[f].default = request.vars[f]
table_name_fields[f] = request.vars[f]
# If there is value in request vars it has priority over
derived value
elif '_' + f in request.vars:
if field_type not in ('date', 'datetime', 'decimal', 'bool'):
db.table_name[f].default = convert(request.vars['_' +
f], field_type)
table_name_fields[f] = convert(request.vars['_' + f],
field_type)
elif field_type in ('date', 'datetime'):
if f == 'date':
db.table_name[f].default =
datetime.datetime.strptime(request.vars['_' + f], '%Y-%m-%d').date()
table_name_fields[f] =
datetime.datetime.strptime(request.vars['_' + f], '%Y-%m-%d').date()
elif f == 'datetime':
db.table_name[f].default =
datetime.datetime.strptime(request.vars['_' + f], '%Y-%m-%d %H:%M:%S')
table_name_fields[f] =
datetime.datetime.strptime(request.vars['_' + f], '%Y-%m-%d %H:%M:%S')
elif field_type == 'decimal':
db.table_name[f].default = Decimal(request.vars['_' + f])
table_name_fields[f] = Decimal(request.vars['_' + f])
elif field_type == 'bool':
if request.vars['_' + f] in ['True']:
request.vars['_' + f] = True
elif request.vars['_' + f] in ['False']:
request.vars['_' + f] = False
else:
request.vars['_' + f] = None
db.table_name[f].default = request.vars['_' + f]
table_name_fields[f] = request.vars['_' + f]
...


On Thu, Nov 3, 2016 at 11:24 AM, Richard Vézina  wrote:

> I come up with this :
>
> def convert(value, type_):
> import importlib
> try:
> # Check if it's a builtin type
> module = importlib.import_module('__builtin__')
> cls = getattr(module, type_)
> except AttributeError:
> # if not, separate module and class
> module, type_ = type_.rsplit(".", 1)
> module = importlib.import_module(module)
> cls = getattr(module, type_)
> return cls(value)
>
> def controller_func():
> ...
> field_type_mapping = \
>  {'id': 'int',
>   'reference': 'int',
>   'boolean': 'bool',
>   'string': 'str',
>   'decimal': 'decimal',
>   'date': 'date',
>   'datetime': 'datetime'}
>
> for f in table_name_fields:
> if db.table_name[f].type.split('(')[0] == 'decimal':
> field_type = field_type_mapping['decimal']
> elif db.table_name[f].type.split(' ')[0] == 'reference':
> field_type = field_type_mapping['reference']
> else:
> field_type = field_type_mapping[db.table_name[f].type]
> if f in request.vars:
> db.table_name[f].default = request.vars[f]
> table_name_fields[f] = request.vars[f]
> # If there is value in request vars it has priority over derived 
> value
> elif '_' + f in request.vars:
> if field_type not in ('date', 'datetime', 'decimal'):
> db.table_name[f].default = convert(request.vars['_' + f], 
> field_type)
> table_name_fields[f] = convert(request.vars['_' + f], 
> field_type)
> elif field_type in ('date', 'datetime'):
> if f == 'date':
> db.table_name[f].default = 
> datetime.datetime.strptime(request.vars['_' + f], '%Y-%m-%d').date()
> table_name_fields[f] = 
> datetime.datetime.strptime(request.vars['_' + f], '%Y-%m-%d').date()
> elif f == 'datetime':
> db.table_name[f].default = 
> datetime.datetime.strptime(request.vars['_' + f], '%Y-%m-%d %H:%M:%S')
> table_name_fields[f] = 
> datetime.datetime.strptime(request.vars['_' + f], '%Y-%m-%d %H:%M:%S')
> elif field_type == 'decimal':
> db.table_name[f].default = Decimal(request.vars['_' + f])
> table_name_fields[f] = Decimal(request.vars['_' + f])
> ...
>
>
>
> But I am sure that there is something to parse request.vars and convert
> string vars into 

Re: [web2py] convert request.vars to set default value in a custom .factory() form

2016-11-03 Thread Richard Vézina
I come up with this :

def convert(value, type_):
import importlib
try:
# Check if it's a builtin type
module = importlib.import_module('__builtin__')
cls = getattr(module, type_)
except AttributeError:
# if not, separate module and class
module, type_ = type_.rsplit(".", 1)
module = importlib.import_module(module)
cls = getattr(module, type_)
return cls(value)

def controller_func():
...
field_type_mapping = \
 {'id': 'int',
  'reference': 'int',
  'boolean': 'bool',
  'string': 'str',
  'decimal': 'decimal',
  'date': 'date',
  'datetime': 'datetime'}

for f in table_name_fields:
if db.table_name[f].type.split('(')[0] == 'decimal':
field_type = field_type_mapping['decimal']
elif db.table_name[f].type.split(' ')[0] == 'reference':
field_type = field_type_mapping['reference']
else:
field_type = field_type_mapping[db.table_name[f].type]
if f in request.vars:
db.table_name[f].default = request.vars[f]
table_name_fields[f] = request.vars[f]
# If there is value in request vars it has priority over
derived value
elif '_' + f in request.vars:
if field_type not in ('date', 'datetime', 'decimal'):
db.table_name[f].default = convert(request.vars['_' +
f], field_type)
table_name_fields[f] = convert(request.vars['_' + f],
field_type)
elif field_type in ('date', 'datetime'):
if f == 'date':
db.table_name[f].default =
datetime.datetime.strptime(request.vars['_' + f], '%Y-%m-%d').date()
table_name_fields[f] =
datetime.datetime.strptime(request.vars['_' + f], '%Y-%m-%d').date()
elif f == 'datetime':
db.table_name[f].default =
datetime.datetime.strptime(request.vars['_' + f], '%Y-%m-%d %H:%M:%S')
table_name_fields[f] =
datetime.datetime.strptime(request.vars['_' + f], '%Y-%m-%d %H:%M:%S')
elif field_type == 'decimal':
db.table_name[f].default = Decimal(request.vars['_' + f])
table_name_fields[f] = Decimal(request.vars['_' + f])
...



But I am sure that there is something to parse request.vars and convert
string vars into their specific type in web2py internal...

Still interested in another cleaner solution...

Thanks

Richard

On Tue, Nov 1, 2016 at 10:45 AM, Richard 
wrote:

> Hello,
>
> I have an high customized SQLFORM.factory() form... I set default value
> for the update form for which I have no problem with values types as they
> get out of the database... But in case I want to emulate keepvalue feature
> with this form I need to pass value to request.vars which I need to set as
> default... The problem is that all value are string when I get them and I
> need to populate many fields and would greatly prefer not have to handle
> each fields manually one by one but instead do it dynamically so if I had
> field to the table I don't have to add it... So I am searching a way to
> convert appropriately value for each field type... I could use the approach
> proposed in the answer accepted hear : http://stackoverflow.com/
> questions/7402573/use-type-information-to-cast-values-stored-as-strings
>
> I there surely such a thing in the web2py internal... I thought
> _filter_fields() would do it, but it only filter field that are member of a
> table, it doesn't act over the value of the field... I thought of using
> requires/validator, but I am not sure how to use them.
>
> Thanks
>
> Richard
>
>
>
> --
> 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] .git file in gluon/packages/dal/.git

2016-11-03 Thread Richard Vézina
My question wasn't very clear... As Giles, summarised, why is .git file in
gluon/packages/dal/  in the stable download package available over
web2py.com ?

Richard

On Thu, Nov 3, 2016 at 9:48 AM, Giles Thomas  wrote:

> @Niphlod -- the confusing thing for me is that the .git file is present in
> the source download from the web2py website.  It makes perfect sense that
> it's present when you do a git checkout, but not when you've downloaded a
> zip file.
>
>
> All the best,
>
> Giles
>
>
> On Wednesday, 2 November 2016 11:02:18 UTC, Niphlod wrote:
>>
>> uhm ... what ?
>>
>> On Tuesday, November 1, 2016 at 7:10:16 PM UTC+1, Richard wrote:
>>>
>>> I agree with you Simone, but should it stay there in the build for pydal
>>> only?
>>>
>>> Richard
>>>
>>> On Tue, Nov 1, 2016 at 1:45 PM, Niphlod  wrote:
>>>
 it's perfectly normal as pydal is a subrepo (it's in the readme, too)


 On Tuesday, November 1, 2016 at 5:43:44 PM UTC+1, Giles Thomas wrote:
>
> Thanks, Richard.
>
> Regarding why -- I'm talking about the version that will be installed
> by default when someone creates a web2py app on the hosting platform my
> company provides, PythonAnywhere -- which would also affect the version
> used by the "Try it now online" link on the front page of
> www.web2py.com.  I agree that doing version control the web2py way is
> probably more sensible than making the whole web2py folder a git repo, but
> if people do want to follow the git route, it would be better if we didn't
> have that "trap" in there for them :-)
>
>
> All the best,
>
> Giles
>
>
> On Tuesday, 1 November 2016 16:13:22 UTC, Richard wrote:
>>
>> Sorry, you right in there is gluon/packages/dal/.git, I thought you
>> were speaking of a .git/ folder at the root of web2py which there is 
>> not...
>>
>> I guess you can delete it if it cause problem, but if you have issue
>> with it, it means you try to init you git repo over the entire web2py
>> folder?
>>
>> Why don't you just version control your app? which is what we usually
>> do...
>>
>> Thanks
>>
>> Richard
>>
>> On Tue, Nov 1, 2016 at 10:51 AM, Giles Thomas 
>> wrote:
>>
>>> The one labelled "For normal users", so presumably stable.  The
>>> VERSION file says:
>>>
>>> Version 2.14.6-stable+timestamp.2016.05.10.00.21.47
>>>
>>>
>>> All the best,
>>>
>>> Giles
>>>
>>> On Tuesday, 1 November 2016 14:48:03 UTC, Richard wrote:

 Nightly or stable? I don't have it in my last build 2.14.6 I
 think...

 Richard

 On Tue, Nov 1, 2016 at 10:42 AM, Giles Thomas 
 wrote:

> This is in a download from web2py.com -- specifically, the
> "Source code" download from http://www.web2py.com/ini
> t/default/download.
>
> Interestingly, gluon/packages/dal/.git is a file rather than a
> directory.  It contains this:
>
> gitdir: ../../../.git/modules/gluon/packages/dal
>
>
>
> All the best,
>
> Giles
>
>
>
>
> On Tuesday, 1 November 2016 13:25:51 UTC, Richard wrote:
>>
>> Do you download from Github or web2py.com? The later you
>> shouldn't have this issue... If you get web2py from git, it normal 
>> that you
>> have .git/ for web2py and for dal as dal have been extract from 
>> web2py and
>> is a project of it own so it is include in the web2py repository as a
>> submodule.
>>
>> Richard
>>
>> On Tue, Nov 1, 2016 at 8:50 AM, Giles Thomas > > wrote:
>>
>>> Hi all,
>>>
>>> Someone pointed out to us that web2py has a .git file in
>>> gluon/packages/dal/.git.  This can cause errors when you try to 
>>> initialize
>>> your project as a git repo.  Is there a specific reason for it to be
>>> there?  Or is it an artefact of the packaging procedure?  We're 
>>> considering
>>> removing it from the source that we install for users on 
>>> PythonAnywhere,
>>> but wanted to check first to make sure that we're not going to break
>>> anything or cause problems for our users.
>>>
>>>
>>> All the best,
>>>
>>> Giles
>>> --
>>> Giles Thomas 
>>>
>>> PythonAnywhere: Develop and host Python from your browser
>>> 
>>>
>>> A product from PythonAnywhere LLP
>>> 17a Clerkenwell Road, London EC1M 5RD, UK
>>> VAT No.: GB 893 5643 79

Re: [web2py] .git file in gluon/packages/dal/.git

2016-11-03 Thread Giles Thomas
@Niphlod -- the confusing thing for me is that the .git file is present in 
the source download from the web2py website.  It makes perfect sense that 
it's present when you do a git checkout, but not when you've downloaded a 
zip file.


All the best,

Giles


On Wednesday, 2 November 2016 11:02:18 UTC, Niphlod wrote:
>
> uhm ... what ?
>
> On Tuesday, November 1, 2016 at 7:10:16 PM UTC+1, Richard wrote:
>>
>> I agree with you Simone, but should it stay there in the build for pydal 
>> only?
>>
>> Richard
>>
>> On Tue, Nov 1, 2016 at 1:45 PM, Niphlod  wrote:
>>
>>> it's perfectly normal as pydal is a subrepo (it's in the readme, too)
>>>
>>>
>>> On Tuesday, November 1, 2016 at 5:43:44 PM UTC+1, Giles Thomas wrote:

 Thanks, Richard.  

 Regarding why -- I'm talking about the version that will be installed 
 by default when someone creates a web2py app on the hosting platform my 
 company provides, PythonAnywhere -- which would also affect the version 
 used by the "Try it now online" link on the front page of 
 www.web2py.com.  I agree that doing version control the web2py way is 
 probably more sensible than making the whole web2py folder a git repo, but 
 if people do want to follow the git route, it would be better if we didn't 
 have that "trap" in there for them :-)


 All the best,

 Giles


 On Tuesday, 1 November 2016 16:13:22 UTC, Richard wrote:
>
> Sorry, you right in there is gluon/packages/dal/.git, I thought you 
> were speaking of a .git/ folder at the root of web2py which there is 
> not...
>
> I guess you can delete it if it cause problem, but if you have issue 
> with it, it means you try to init you git repo over the entire web2py 
> folder?
>
> Why don't you just version control your app? which is what we usually 
> do...
>
> Thanks
>
> Richard
>
> On Tue, Nov 1, 2016 at 10:51 AM, Giles Thomas  
> wrote:
>
>> The one labelled "For normal users", so presumably stable.  The 
>> VERSION file says:
>>
>> Version 2.14.6-stable+timestamp.2016.05.10.00.21.47
>>
>>
>> All the best,
>>
>> Giles
>>
>> On Tuesday, 1 November 2016 14:48:03 UTC, Richard wrote:
>>>
>>> Nightly or stable? I don't have it in my last build 2.14.6 I 
>>> think... 
>>>
>>> Richard
>>>
>>> On Tue, Nov 1, 2016 at 10:42 AM, Giles Thomas  
>>> wrote:
>>>
 This is in a download from web2py.com -- specifically, the "Source 
 code" download from http://www.web2py.com/init/default/download.

 Interestingly, gluon/packages/dal/.git is a file rather than a 
 directory.  It contains this:

 gitdir: ../../../.git/modules/gluon/packages/dal



 All the best,

 Giles




 On Tuesday, 1 November 2016 13:25:51 UTC, Richard wrote:
>
> Do you download from Github or web2py.com? The later you 
> shouldn't have this issue... If you get web2py from git, it normal 
> that you 
> have .git/ for web2py and for dal as dal have been extract from 
> web2py and 
> is a project of it own so it is include in the web2py repository as a 
> submodule.
>
> Richard
>
> On Tue, Nov 1, 2016 at 8:50 AM, Giles Thomas  
> wrote:
>
>> Hi all,
>>
>> Someone pointed out to us that web2py has a .git file in 
>> gluon/packages/dal/.git.  This can cause errors when you try to 
>> initialize 
>> your project as a git repo.  Is there a specific reason for it to be 
>> there?  Or is it an artefact of the packaging procedure?  We're 
>> considering 
>> removing it from the source that we install for users on 
>> PythonAnywhere, 
>> but wanted to check first to make sure that we're not going to break 
>> anything or cause problems for our users.
>>
>>
>> All the best,
>>
>> Giles
>> -- 
>> Giles Thomas 
>>
>> PythonAnywhere: Develop and host Python from your browser
>> 
>>
>> A product from PythonAnywhere LLP
>> 17a Clerkenwell Road, London EC1M 5RD, UK
>> VAT No.: GB 893 5643 79
>> Registered in England and Wales as company number OC378414.
>> Registered address: 28 Ely Place, 3rd Floor, London EC1N 6TD, UK 
>>
>>
>> -- 
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - 

[web2py] Account registration progress

2016-11-03 Thread Joe Lwe
Hi, 
Thanks for your support to web2py, i have added extra fields to signup 
form, but i need the profile of user registered to be completed so that 
they fill form data in sequence
as e.g 
if user registers as business, then the next form should be to add their 
business details, then add  products they offer, if they don't on login in 
they should be requested to complete their profile.

How can i achieve this ..
Thanks again

-- 
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: scheduler creates "zombie" processes

2016-11-03 Thread Erwn Ltmann
@Niphlod: I decided one year ago to use web2py for our projects. And now I 
have a problem and I have to solve it (shortly) - with or without the 
group. You are so focused on the scheduler code itself. I search for any 
hint to understand the problem. It doesn't helps me to know that the 
mankind has never a problem with the scheduler since decades of wonderful 
years. ;)

In the meanwhile I found a way to handle well "my" problematic situations 
(unfortunately a workaround). The answers for the cause are outstanding.

A new try: be abstract away from longlive tasks and timeouts in case of 
normal worker's task processing. The reason for 'my' TIMEOUT is different 
(please trust me, I read the entire code of scheduler.py and know about the 
general concept).

scheduler.py (worker): infinity loop -> pop a task -> call async function 
-> create process environment -> start the process[1] -> wait for 
completion the process or have no mercy and terminate the process if 
timeout caught.

So far so good. Now a more detailed look for [1].

The process environment has an entry function as target (start point) to 
start the sub process. In the case of scheduler.py it is the function 
'executor'. Again, the entry point of this function we want never pass in 
case of 'zombie' candidates. With pstack I saw the reason: the new process 
creation process is waiting for a semaphore - sem_wait(). At this point of 
the sub process nothing is passed in 'executor' function and because of 
that nothing is processed of my actually task. Of course because the 
'executer' didn't call "my" task function.

So, the scheduler's executor catchs the timeout (sub process is still 
waiting for a semaphore) and call termiate() for the sub process. This 
process is still waiting again and again and again ... The scheduler.py 
registered in the meanwhile the task as STOPPED and go ahead to pick up the 
next task.

Back to my pstree output with additional comments inside for example:

bash(16731)  // my shell
>
\---python2.7(24545) // 
> scheduler.py (-K)
>
  \-+-python2.7(24564)---{python2.7}(24565)  // idling 
> worker 
>   |-python2.7(24572) // worker 
> with picked task
>
  \-python2.7(1110)  // still 
> waiting for semaphore (TIMEOUT)
>   \-python2.7(8647)  // still 
> waiting for semaphore (TIMEOUT)
>   \-python2.7(11747) // still 
> waiting for semaphore (TIMEOUT)
>   \-python2.7(14117) // run the 
> actually task (RUNNING)
>   \-python2.7(14302) // still 
> waiting for semaphore (TIMEOUT)
>

The actually reason is "waiting for a semaphore". But way? And of course in 
all propabillity it is not a problem of the scheduler.py code itself ;)

Thx again for your endurance.
Erwn

-- 
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: What is the recommended way to translate dynamic contents in a multilingual website?

2016-11-03 Thread at

Thank you Leonel for your reply. I am looking into the suggested solutions.

On Wednesday, 2 November 2016 18:21:51 UTC+5, Leonel Câmara wrote:
>
> If I understood your question correctly, I think I have answered this, 
> here:   
>
> https://groups.google.com/forum/#!topic/web2py/y1QYmM4HfeM
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: How to start a scheduler task from a module?

2016-11-03 Thread Martin Weissenboeck
Yes - that's it. Now I can add tasks from a module.
Thank you again very much!

Martin

2016-11-02 22:31 GMT+01:00 Niphlod :

> tl;dr : it just gets automatically filled with
> "request.application/request.controller" in a web environment that it is
> missing in your module.
>

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