[web2py] Re: Weird Javascript Behavior -- 2 clicks to fire (Sorry, Dont know where else to turn)

2016-04-29 Thread Stuart Rolinson
Hi Mark,

Can you pull together a simple example showing this with your HTML, CSS and 
Javascript.  I understand what you are trying to do but I need to see more 
in order to understand when the click event is being applied to the 
.iframe_add objects.

Thanks
Stuart

On Friday, April 29, 2016 at 1:17:24 PM UTC-7, Mark Billion wrote:
>
> Here's the script.  When I click it on load, works like a charm.  When I 
> click it via a dynamically created element, the first click sees the actual 
> html shift (kind of stretch and go back).  It does however work on the 
> second click consistently. 
>
> 
> $(document).on('click', '.iframe_add', function(){
> var element = $(this).attr('name');
> $('#iframe_target').html('');
> });
> 
>
> 
>
> Only thing I found is: 
> http://stackoverflow.com/questions/24487664/jquery-on-click-doesnt-work-on-first-click-with-a-dynamic-element
>
> I dont really get whats going on and Id  appreciate any 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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Weird Javascript Behavior -- 2 clicks to fire (Sorry, Dont know where else to turn)

2016-04-29 Thread Massimo Di Pierro
Hello Mark,

can you explain one moment the big picture. What do you want your app to do?

Massimo


On Friday, 29 April 2016 15:17:24 UTC-5, Mark Billion wrote:
>
> Here's the script.  When I click it on load, works like a charm.  When I 
> click it via a dynamically created element, the first click sees the actual 
> html shift (kind of stretch and go back).  It does however work on the 
> second click consistently. 
>
> 
> $(document).on('click', '.iframe_add', function(){
> var element = $(this).attr('name');
> $('#iframe_target').html('');
> });
> 
>
> 
>
> Only thing I found is: 
> http://stackoverflow.com/questions/24487664/jquery-on-click-doesnt-work-on-first-click-with-a-dynamic-element
>
> I dont really get whats going on and Id  appreciate any 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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Looking for PRPC Senior System Architect (SSA) in multiple locations.....phoenix, AZ/// Plantation, FL with TCS/ AMEX

2016-04-29 Thread Massimo Di Pierro
Salma has been banned.

On Friday, 29 April 2016 10:43:49 UTC-5, Ron Chatterjee wrote:
>
> Hey Salma,
>
> Looking at this post...it seems Pega is as much related to chess as it is 
> to web2py. Why its posted on this forum? Just asking...
>
> -Ron
>
>
> On Friday, April 29, 2016 at 11:20:06 AM UTC-4, salma bhat wrote:
>>
>> Hi Partners!
>>
>>  
>>
>> Please provide some valuable resources for this position.
>>
>>  
>>
>> *Position: PRPC Senior System Architect*
>>
>> *Location: Phoenix, AZ/ Plantation, FL*
>>
>> *Client: TCS*
>>
>> *Duration: 12+ months*
>>
>>  
>>
>> *Key Responsibilities And Accountabilities:*
>>
>>  
>>
>> Responsible for designing and building components of application. 
>> Providing consultative guidance on all project assignments.  Works as part 
>> of a project team to ensure that the business and technical architecture of 
>> the delivered solution matches customer requirements.  
>>
>> Key Result Areas:
>>
>>  Actively participate in the requirements, design and build phases; 
>> delivering high quality deliverables.
>>
>>  Assist with planning and execution of unit, integration and user 
>> acceptance testing.
>>
>>  Has an advanced understanding of the main features of PRPC.
>>
>>  Facilitate knowledge transfer of PRPC functionality and application 
>> functionality.
>>
>>  Complete work in time / effort budget.  Provide proactive update to 
>> project leader if timelines or effort estimate are in jeopardy.  
>>
>>  Realization of business benefit
>>
>> Core Competencies:
>>
>>  Architecture and Design of PRPC
>>
>>  Coaching Others
>>
>>  Consultative Skills
>>
>>  Decision Making
>>
>>  Domain Expertise
>>
>>  Enterprise Application System Understanding
>>
>>  Pega Expertise and Learning
>>
>>  Presentation Skills
>>
>>  
>>
>>  
>>
>>  
>>
>>  
>>
>>  
>>
>> *Salma Bhat*
>>
>> Desk : 609-853-0818 Ext: 2121
>>
>> salma...@nityo.com
>>
>> *Nityo Infotech Corp. *
>>
>> 666 Plainsboro Road, Suite 1285 Plainsboro, NJ 08536
>>
>> USA | Canada | India | Singapore | Malaysia | Indonesia | Philippines | 
>> Thailand  | UK |Australia|Zealand  |
>>
>>
>> ___
>>
>

-- 
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] Weird Javascript Behavior -- 2 clicks to fire (Sorry, Dont know where else to turn)

2016-04-29 Thread Mark Billion
Here's the script.  When I click it on load, works like a charm.  When I 
click it via a dynamically created element, the first click sees the actual 
html shift (kind of stretch and go back).  It does however work on the 
second click consistently. 


$(document).on('click', '.iframe_add', function(){
var element = $(this).attr('name');
$('#iframe_target').html('');
});




Only thing I found 
is: 
http://stackoverflow.com/questions/24487664/jquery-on-click-doesnt-work-on-first-click-with-a-dynamic-element

I dont really get whats going on and Id  appreciate any 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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Version spanish the book with error

2016-04-29 Thread domezzzz
Tank Richard and Massimo from Montevideo/Uruguay

El jueves, 28 de abril de 2016, 16:42:56 (UTC-3), dome...@gmail.com 
escribió:
>
> Access to books in Spanish version, except the prologue, gives the 
> following error since leaving web2py 2.14.x
>
> Access:
> http://web2py.com/books/default/chapter/41/01/introduccion
>
> Response:
> "
> Internal errorTicket issued: 
> books/167.60.25.205.2016-04-28.19-34-49.e80354e6-8fee-47e8-9512-2525744cda96 
> 
> "
>
> and the error indicates:
>
> "Admin deshabilitado, el canal no es seguro"
>

-- 
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: Can't access scheduler_task table ['DAL' object has no attribute 'scheduler_task']

2016-04-29 Thread Marty Jones
I seem to have resolved it by switching "db = current.db" to "db = 
current.globalenv['db']"

On Friday, April 29, 2016 at 12:05:34 PM UTC-4, Marty Jones wrote:
>
> I'm defining some functions in the modules folder that need to access and 
> insert rows into the db. in the controller, I define "current.db = db" then 
> in the module I import the db as seen below.
>
> I define the function below and attempt to import it and queue it up using 
> Scheduler, but receive "'DAL' object has no attribute 'scheduler_task'". 
> What am I missing?
>
> #!/usr/bin/env python
> # -*- coding: utf-8 -*-
> from gluon import *
> from gluon import current
>
> def insert_task():
> db = current.db
> db.scheduler_task.insert(status = 'QUEUED',
>  application_name = 'my_application/default',
>  task_name = 'download',
>  group_name = 'scrape',
>  function_name = 'download',
>  args = '[]',
>  vars = '{}',
>  enabled = True,
>  start_time = request.now,
>  timeout = 500,
>  )
>
>
>

-- 
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: Can't access scheduler_task table ['DAL' object has no attribute 'scheduler_task']

2016-04-29 Thread Dave S
On Friday, April 29, 2016 at 9:05:34 AM UTC-7, Marty Jones wrote:
>
> I'm defining some functions in the modules folder that need to access and 
> insert rows into the db. in the controller, I define "current.db = db" then 
> in the module I import the db as seen below.
>
> I define the function below and attempt to import it and queue it up using 
> Scheduler, but receive "'DAL' object has no attribute 'scheduler_task'". 
> What am I missing?
>
> #!/usr/bin/env python
> # -*- coding: utf-8 -*-
> from gluon import *
> from gluon import current
>
> def insert_task():
> db = current.db
> db.scheduler_task.insert(status = 'QUEUED',
>  application_name = 'my_application/default',
>  task_name = 'download',
>  group_name = 'scrape',
>  function_name = 'download',
>  args = '[]',
>  vars = '{}',
>  enabled = True,
>  start_time = request.now,
>  timeout = 500,
>  )
>
>
> Have you instantiated the scheduler elsewhere?  I don't think the tables 
exist until the first time you do, and it's not worth the effort to create 
your own table def and try to get all the fields to match.

/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] Can't access scheduler_task table ['DAL' object has no attribute 'scheduler_task']

2016-04-29 Thread Marty Jones
I'm defining some functions in the modules folder that need to access and 
insert rows into the db. in the controller, I define "current.db = db" then 
in the module I import the db as seen below.

I define the function below and attempt to import it and queue it up using 
Scheduler, but receive "'DAL' object has no attribute 'scheduler_task'". 
What am I missing?

#!/usr/bin/env python
# -*- coding: utf-8 -*-
from gluon import *
from gluon import current

def insert_task():
db = current.db
db.scheduler_task.insert(status = 'QUEUED',
 application_name = 'my_application/default',
 task_name = 'download',
 group_name = 'scrape',
 function_name = 'download',
 args = '[]',
 vars = '{}',
 enabled = True,
 start_time = request.now,
 timeout = 500,
 )


-- 
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: Looking for PRPC Senior System Architect (SSA) in multiple locations.....phoenix, AZ/// Plantation, FL with TCS/ AMEX

2016-04-29 Thread Ron Chatterjee
Hey Salma,

Looking at this post...it seems Pega is as much related to chess as it is 
to web2py. Why its posted on this forum? Just asking...

-Ron


On Friday, April 29, 2016 at 11:20:06 AM UTC-4, salma bhat wrote:
>
> Hi Partners!
>
>  
>
> Please provide some valuable resources for this position.
>
>  
>
> *Position: PRPC Senior System Architect*
>
> *Location: Phoenix, AZ/ Plantation, FL*
>
> *Client: TCS*
>
> *Duration: 12+ months*
>
>  
>
> *Key Responsibilities And Accountabilities:*
>
>  
>
> Responsible for designing and building components of application. 
> Providing consultative guidance on all project assignments.  Works as part 
> of a project team to ensure that the business and technical architecture of 
> the delivered solution matches customer requirements.  
>
> Key Result Areas:
>
>  Actively participate in the requirements, design and build phases; 
> delivering high quality deliverables.
>
>  Assist with planning and execution of unit, integration and user 
> acceptance testing.
>
>  Has an advanced understanding of the main features of PRPC.
>
>  Facilitate knowledge transfer of PRPC functionality and application 
> functionality.
>
>  Complete work in time / effort budget.  Provide proactive update to 
> project leader if timelines or effort estimate are in jeopardy.  
>
>  Realization of business benefit
>
> Core Competencies:
>
>  Architecture and Design of PRPC
>
>  Coaching Others
>
>  Consultative Skills
>
>  Decision Making
>
>  Domain Expertise
>
>  Enterprise Application System Understanding
>
>  Pega Expertise and Learning
>
>  Presentation Skills
>
>  
>
>  
>
>  
>
>  
>
>  
>
> *Salma Bhat*
>
> Desk : 609-853-0818 Ext: 2121
>
> salma...@nityo.com 
>
> *Nityo Infotech Corp. *
>
> 666 Plainsboro Road, Suite 1285 Plainsboro, NJ 08536
>
> USA | Canada | India | Singapore | Malaysia | Indonesia | Philippines | 
> Thailand  | UK |Australia|Zealand  |
>
>
> ___
>

-- 
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] Looking for PRPC Senior System Architect (SSA) in multiple locations.....phoenix, AZ/// Plantation, FL with TCS/ AMEX

2016-04-29 Thread salma bhat
Hi Partners!



Please provide some valuable resources for this position.



*Position: PRPC Senior System Architect*

*Location: Phoenix, AZ/ Plantation, FL*

*Client: TCS*

*Duration: 12+ months*



*Key Responsibilities And Accountabilities:*



Responsible for designing and building components of application. Providing
consultative guidance on all project assignments.  Works as part of a
project team to ensure that the business and technical architecture of the
delivered solution matches customer requirements.

Key Result Areas:

 Actively participate in the requirements, design and build phases;
delivering high quality deliverables.

 Assist with planning and execution of unit, integration and user
acceptance testing.

 Has an advanced understanding of the main features of PRPC.

 Facilitate knowledge transfer of PRPC functionality and application
functionality.

 Complete work in time / effort budget.  Provide proactive update to
project leader if timelines or effort estimate are in jeopardy.

 Realization of business benefit

Core Competencies:

 Architecture and Design of PRPC

 Coaching Others

 Consultative Skills

 Decision Making

 Domain Expertise

 Enterprise Application System Understanding

 Pega Expertise and Learning

 Presentation Skills











*Salma Bhat*

Desk : 609-853-0818 Ext: 2121

salma.b...@nityo.com 

*Nityo Infotech Corp. *

666 Plainsboro Road, Suite 1285 Plainsboro, NJ 08536

USA | Canada | India | Singapore | Malaysia | Indonesia | Philippines |
Thailand  | UK |Australia|Zealand  |

___

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


[web2py] Re: web2py 2.14.4 is OUT

2016-04-29 Thread Jim Spoerl
I am a new user.  With both the 2.9 (stable) and this latest I cannot get 
the KPAX cms to run.  web2py seems ok and the KPAX installs with no errors. 
 This is on a Macbook Pro running Yosemite with bundled Python 2.7.  Thanks 
for your help.

On Tuesday, April 12, 2016 at 5:29:26 PM UTC-4, Massimo Di Pierro wrote:
>
> web2py 2.14.4 is out.
>
> It fixes some a problem with CAS and some style issues with examples.
> It also includes (and passes) a lot of new tests. 
>
> Thanks to Richard Vezina, Simone and Leonel for doing most of the work in 
> this release.
>
> Massimo
>

-- 
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] Version spanish the book with error

2016-04-29 Thread Massimo Di Pierro
fixed.

On Friday, 29 April 2016 09:25:52 UTC-5, Richard wrote:
>
> You can't access the admin app when in production for security reason... 
>
> I think Massimo should have a look at the issue...
>
> Richard
>
> On Thu, Apr 28, 2016 at 3:42 PM,  wrote:
>
>> Access to books in Spanish version, except the prologue, gives the 
>> following error
>>
>> Access:
>> http://web2py.com/books/default/chapter/41/01/introduccion
>>
>> Response:
>> "
>> Internal errorTicket issued: 
>> books/167.60.25.205.2016-04-28.19-34-49.e80354e6-8fee-47e8-9512-2525744cda96 
>> 
>> "
>>
>> and the error indicates:
>>
>> "Admin deshabilitado, el canal no es seguro"
>>
>> -- 
>> 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: appconfig, host.names

2016-04-29 Thread Mirek Zvolský
For me wasn't clear if it should be string, list, or ..., how to set for 
localhost and so on...?
However now it is clear to me. -- It's enough take a look into 
applications/welcome/private
Thanks.




Dne středa 27. dubna 2016 8:35:10 UTC+2 Niphlod napsal(a):
>
> put there the host your app is on. it's mainly used to avoid sending 
> emails with a wrong url, given that that is the only place you're going to 
> need an absolute one ^_^
>
> On Wednesday, April 27, 2016 at 7:58:47 AM UTC+2, Mirek Zvolský wrote:
>>
>> Please, an example for this.
>> (+ should be in the book)
>>
>>

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


Re: [web2py] Version spanish the book with error

2016-04-29 Thread Richard Vézina
You can't access the admin app when in production for security reason...

I think Massimo should have a look at the issue...

Richard

On Thu, Apr 28, 2016 at 3:42 PM,  wrote:

> Access to books in Spanish version, except the prologue, gives the
> following error
>
> Access:
> http://web2py.com/books/default/chapter/41/01/introduccion
>
> Response:
> "
> Internal errorTicket issued:
> books/167.60.25.205.2016-04-28.19-34-49.e80354e6-8fee-47e8-9512-2525744cda96
> 
> "
>
> and the error indicates:
>
> "Admin deshabilitado, el canal no es seguro"
>
> --
> 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: django type adding or append fields using plus sign to your table

2016-04-29 Thread billmackalister
works:
Field("something", 'list:string'),
Field("someting2", 'list:integer'),

But no such thing as:
Field("something3", 'list:datetime')

I imagine its same as upload field, we need to create a one to many 
relationships with a table. Any shortcuts?



On Tuesday, January 19, 2016 at 2:47:44 AM UTC-5, Manuele wrote:
>
> Il 19/01/16 03:17, 黄祥 ha scritto:
>
> just wondering why the requires list in a list type [] is not work 
> properly when update (when insert goes fine): 
> e.g.
> table.email.requires = IS_LIST_OF([IS_LOWER(), IS_EMAIL(), *IS_NOT_IN_DB(db, 
> table.email)* ] )
>
> In case of update I think you have to change the validator logic because 
> email uniqueness is no more requested or in case you update using a form 
> maybe the detect_record_change[1] can help you.
>
> Cheers
>
> M.
>
> [1] 
> http://web2py.com/books/default/chapter/29/07/forms-and-validators#Detect-record-change
>
>
> the problem when update is validator IS_NOT_IN_DB() is always true
> Value already in database or empty
>
> any idea how to face this?
>
> 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+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.


[web2py] Re: Execution of import statements

2016-04-29 Thread Niphlod
it's like math with parenthesis...

if b == 1:
 import a

will trigger "import a" when b == 1 . the first time b==1 it'd be a real 
import, the second time it'd be a no-op

if b is never going to be == 1, import will be never triggered.

On Friday, April 29, 2016 at 3:32:05 PM UTC+2, Mark Billion wrote:
>
> Right, but if the import is a conditional one -- ie, only import a if a 
> condition evals to true -- does it no op the import if the condition goes 
> to false or does it import all and then execute?
>
> On Friday, April 29, 2016 at 3:23:40 AM UTC-4, Niphlod wrote:
>>
>> in python if you have 
>>
>>
>> import a
>> blablabla
>> import b
>> blablabla
>> import a
>>
>> the second "import a" statement is executed, but is a no-op.
>>
>> On Friday, April 29, 2016 at 1:20:59 AM UTC+2, Mark Billion wrote:
>>>
>>> I understand that the whole default.py file is executed on each request 
>>> to a function internal to it. But does it import if the statement evaluates 
>>> to false?
>>>
>>> For example if default.py has:
>>>
>>> Function x():
>>>   If 1==2:
>>> Import a
>>>
>>> Does a get imported every time function x is called?
>>>
>>>

-- 
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: Execution of import statements

2016-04-29 Thread Mark Billion
Right, but if the import is a conditional one -- ie, only import a if a 
condition evals to true -- does it no op the import if the condition goes 
to false or does it import all and then execute?

On Friday, April 29, 2016 at 3:23:40 AM UTC-4, Niphlod wrote:
>
> in python if you have 
>
>
> import a
> blablabla
> import b
> blablabla
> import a
>
> the second "import a" statement is executed, but is a no-op.
>
> On Friday, April 29, 2016 at 1:20:59 AM UTC+2, Mark Billion wrote:
>>
>> I understand that the whole default.py file is executed on each request 
>> to a function internal to it. But does it import if the statement evaluates 
>> to false?
>>
>> For example if default.py has:
>>
>> Function x():
>>   If 1==2:
>> Import a
>>
>> Does a get imported every time function x is called?
>>
>>

-- 
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: caching questions

2016-04-29 Thread Niphlod
pythonanywhere has a totally different set of limits but if you choose a 
PaaS, you don't get to worry about nitty gritty details .

you're right, the book is an optimal candidate for caching and if you see 
its code it's actually cached everywhere  although the book isn't a 
good example because it never had a database in the first place

On Friday, April 29, 2016 at 2:38:57 PM UTC+2, Pierre wrote:
>
> ok
> I'll check if I can afford the single worker version to start with and I 
> hope this one knows how to spawn
> Is the web2py book at pythonAnywhere cached ? If I didn't miss too many 
> things, it's a good candidate for caching
>

-- 
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: caching questions

2016-04-29 Thread Pierre
ok
I'll check if I can afford the single worker version to start with and I 
hope this one knows how to spawn
Is the web2py book at pythonAnywhere cached ? If I didn't miss too many 
things, it's a good candidate for caching

-- 
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: caching questions

2016-04-29 Thread Niphlod
pythonanywhere is a PaaS, and one of the simpler... start worrying when 
your site isn't speedy enough.
Fortunately you won't have to change a single thing in your app if no the 
cache initialization...

On Friday, April 29, 2016 at 10:58:34 AM UTC+2, Pierre wrote:
>
>
>> When you face the problem of scaling to serve more concurrent requests, 
>> either you do spawning more processes, or adding servers.
>> Adding frontend servers is easy: the data is transactionally consistent 
>> as long as you have a single database instance. You put a load balancer in 
>> front of frontends (it's relatively inexpensive) and go on.
>>
>
> How am I suppose to *spawn more processes* ? PythonAnywhere has this 
> concept of* workers*. The more workers the more you need to pay. Is 
> spawning more processes related to buying more workers ? what kind of a 
> hosting service/company is good at dealing with scaling and caching ?. I 
> don't think Pythonanywhere allows Redis or Memcache...
>
>
> thanks guys
>
> 10 seconds of silence isn't enough...but silence is as 'workers' 
> it's expensive.. 
>
>
>

-- 
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 integrate SendGrid in Web2py ?

2016-04-29 Thread Ron Chatterjee
Thank you Michael. Great tips!

-- 
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: caching questions

2016-04-29 Thread Pierre

>
>
> When you face the problem of scaling to serve more concurrent requests, 
> either you do spawning more processes, or adding servers.
> Adding frontend servers is easy: the data is transactionally consistent as 
> long as you have a single database instance. You put a load balancer in 
> front of frontends (it's relatively inexpensive) and go on.
>

How am I suppose to *spawn more processes* ? PythonAnywhere has this 
concept of* workers*. The more workers the more you need to pay. Is 
spawning more processes related to buying more workers ? what kind of a 
hosting service/company is good at dealing with scaling and caching ?. I 
don't think Pythonanywhere allows Redis or Memcache...


thanks guys

10 seconds of silence isn't enough...but silence is as 'workers' 
it's expensive.. 


-- 
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: update table and calculate FIFO methods

2016-04-29 Thread 黄祥
def __after_insert_redemption_detail(f, id):
query_unit = db.unit.account == f['account']
row_unit = db(query_unit).select(orderby = ~current.db.unit.id).first()

insert_unit_unit = row_unit.unit - f['unit'] if row_unit else f['unit']
insert_unit_previous_unit = row_unit.unit if row_unit else 0
insert_unit_trade_unit = insert_unit_unit - insert_unit_previous_unit
insert_unit_trade_amount = insert_unit_trade_unit * f['nav_per_unit']
insert_unit_amount = insert_unit_unit * f['nav_per_unit']
insert_unit_due_date = datetime.datetime.strptime(f['nav_date'], 
'%Y-%m-%d').date() + datetime.timedelta(days = 0)

db.unit.insert(account = f['account'], unit = insert_unit_unit, 
previous_unit = insert_unit_previous_unit, 
  trade_unit = insert_unit_trade_unit, nav_date = f['nav_date'], 
nav_per_unit = f['nav_per_unit'], 
  trade_amount = insert_unit_trade_amount, amount = 
insert_unit_amount,due_date = insert_unit_due_date)

redemption_unit = f['unit']

rows_remaining_unit = db(query_unit & db.unit.remaining_unit > 
0).select(orderby = current.db.unit.id)
first_row_remaining_unit = rows_remaining_unit.first()
if redemption_unit <= first_row_remaining_unit.remaining_unit:
db(db.unit.id == first_row_remaining_unit.id).update(remaining_unit = 
db.unit(first_row_remaining_unit.id).remaining_unit - redemption_unit)
else:
for row_remaining_unit in rows_remaining_unit:
if redemption_unit > row_remaining_unit.remaining_unit and redemption_unit 
!= 0:
db(db.unit.id == row_remaining_unit.id).update(remaining_unit = 
db.unit(first_row_remaining_unit.id).remaining_unit - 
row_remaining_unit.remaining_unit)
redemption_unit = redemption_unit - row_remaining_unit.remaining_unit
elif redemption_unit <= row_remaining_unit.remaining_unit and 
redemption_unit != 0:
db(db.unit.id == row_remaining_unit.id).update(remaining_unit = 
db.unit(row_remaining_unit.id).remaining_unit - redemption_unit)
redemption_unit = 0

my bad, just have wrong logic in orderby and double check conditional if

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: Execution of import statements

2016-04-29 Thread Niphlod
in python if you have 


import a
blablabla
import b
blablabla
import a

the second "import a" statement is executed, but is a no-op.

On Friday, April 29, 2016 at 1:20:59 AM UTC+2, Mark Billion wrote:
>
> I understand that the whole default.py file is executed on each request to 
> a function internal to it. But does it import if the statement evaluates to 
> false?
>
> For example if default.py has:
>
> Function x():
>   If 1==2:
> Import a
>
> Does a get imported every time function x is called?
>
>

-- 
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: Using python as an user rules engine in a web2py application

2016-04-29 Thread Carlos Kitu
Thanks again Richard, Dave for your useful hints.

Just to clarify, the need of trusting a user with formula editing is for 
allowing a non-IT trusted user to edit the business logic that has to be 
processed in an application. That means getting data from the database, 
processing it, storing the results in the database. Dictionaries proved to 
be a safe way to deliver and receive data to/from the business rules.

Traditionally, this issue has been solved before with a business rules 
engine. Drools (http://www.drools.org/) is a good example I got to know, 
and I was looking for something similar for python when I realized that it 
is not easy to find those tools for python, probably because this language 
is easy enough.

With regard to Jupyter, it has been for a long time in my radar, but I had 
no time to get to it. As for what I have read, Jupyter would be safe place 
to allow people to operate with the data but maybe there is no easy way to 
allow the user to give back the processed data, as Richard mentiond, but 
maybe I'm wrong.

I don't foresee a lot of people editing formulas. This would be a critical 
task assigned to a well known and trusted user.

Until now, as for the suggestiongs received I'm more inclined to explore 
the DSL way or creating a safe sandbox in python.

Thank you guys for your useful help and interest.

Best regards.

El jueves, 28 de abril de 2016, 22:33:29 (UTC+2), Richard escribió:
>
> Good points... I forgot about the aspect of changing site way to make 
> calculation... At the same time, I understand the need as more specific for 
> some user the rest of the crowd stock with the basic calculation if they 
> don't know how to hack their own calculation function... In this context 
> Jupyter seems a good choice... It may seems odd to add such a dependancy 
> for the need at first but considering that your application can evolve and 
> you may be victim of the success you may need to extend the user base of 
> the feature and at some point you will not be able to "trust" your user(s) 
> (if you ever be able too)...
>
> On Thu, Apr 28, 2016 at 3:13 PM, Dave S > 
> wrote:
>
>> On Thursday, April 28, 2016 at 12:01:50 PM UTC-7, Richard wrote:
>>>
>>> Why not just found a way to attach Ipython notebook (which seem to had 
>>> been renamed Jupyter) to your app?? 
>>>
>>> https://jupyter.org/
>>>
>>> By providing dataset over which users can interact with... I am not sure 
>>> exactly how to do that, but one idea could be to db select data that user 
>>> can play with inside a module that can be import in an notebook...
>>>
>>> It would be very powerful and you don't have to care about security as 
>>> it assured by ipython notebook...
>>>
>>> Richard
>>>
>>
>> That would be appropriate if the user just needs to play around with the 
>> data because they're looking for something interesting, or need a one-time 
>> calculation.
>>
>> If the user ("semi-administrator") needs to change how the website does a 
>> calculation that other users will see, a DSL would seem to be more 
>> appropriate.  Or maybe one of those visual programming things where you use 
>> "virtual Lego(tm) pieces" which are compute blocks that you connect up (I 
>> don't know of any of those that would fit in as an IDE the way the web2py 
>> IDE fits the admin app).  Yet Another Option would be a server-side sandbox 
>> that could flag unsafe actions, but I have no information on such a beast.
>>
>> /dps
>>  
>>
>>>
>>>
>>>
>>> On Thu, Apr 28, 2016 at 2:31 AM, Carlos Kitu  wrote:
>>>
 Thank you very much Leonel. This is also a very useful hint. As with 
 the previous recommendation I need a deeper knowledge about the subject to 
 make a decission, and this is a good point to start with.

 Thank you and best regards.

 El miércoles, 27 de abril de 2016, 14:48:18 (UTC+2), Leonel Câmara 
 escribió:
>
> Have you considered creating a DSL? Creating a DSL in python is quite 
> easy. Python might be easy but it is still an imperative language, 
> non-programmers don't think in either imperative or functional terms, 
> they 
> think declaratively, they want to declare what they want to the computer 
> and let it figure it out how to do it.
>
 -- 
 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