[web2py] Web2py Docker

2017-07-21 Thread briannd81
I've searched through the discussion archive before posting this question. 
There were few threads here and there but nothing definitive.

Please share your experience with using the web2py docker image. Can you 
recommend a docker image(s) that you've been using in production?

Thanks,
CD

-- 
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: Page with four LOAD components is too slow

2017-07-21 Thread Leonel Câmara
What I mean is that nowadays it's not that expensive to have a 256GB server 
with 20 cores. So instead of having a load balancer, a lot of machines 
running web and application servers, a lot of other machines running 
databases, etc. You can start with a small server and keep improving it for 
quite a long time without ever needing more than a single machine. That's 
what I mean by vertical scaling.  
  
Nowadays when a single computer isn't enough, well that's a good problem to 
have, and you can afford to have people solve all the problems of 
horizontal scaling for you,

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


[web2py] Re: Page with four LOAD components is too slow

2017-07-21 Thread 黄祥
@leonel, might i know what do you mean with scaling horizontally and 
scaling vertically?

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: web2py deployment strategies

2017-07-21 Thread pbreit
There are lots of easy ways to optimize for scaling up. Spend your energy 
on end user functionality until you run into issues.

-- 
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: Page with four LOAD components is too slow

2017-07-21 Thread Leonel Câmara
I'm using a 32GB quad core server, which is way **way** more than I need at 
the moment, but soyoustart is ridiculously cheap and I have this stupid 
idea that before scaling horizontally you scale vertically as much as 
possible.  

-- 
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: Auth.signature not updating update_on

2017-07-21 Thread António Ramos
Great and simple.
Thank you Anthony

2017-07-21 22:19 GMT+01:00 Anthony :

> In appadmin, I think all fields are made writable, which means the
> modified_on field should appear in the form - is that what you see? If so,
> the old value will simply be submitted with the form, so the value will not
> be updated (unless you manually change it).
>
> The automatic update will only happen if no value is submitted with the
> form (i.e., the field is not included in the form).
>
> 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.
>

-- 
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: Auth.signature not updating update_on

2017-07-21 Thread Anthony
In appadmin, I think all fields are made writable, which means the modified_on 
field should appear in the form - is that what you see? If so, the old value 
will simply be submitted with the form, so the value will not be updated 
(unless you manually change it).

The automatic update will only happen if no value is submitted with the form 
(i.e., the field is not included in the form).

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: ValueError: Field is already bound to a table <-- need a fix for this

2017-07-21 Thread Joe Barnhart
Yes.  I just tested with 2.15.2 and all works perfectly as expected.

-- Joe


On Thursday, July 20, 2017 at 2:58:08 PM UTC-7, Massimo Di Pierro wrote:
>
> Can you confirm all is good now with 2.15.2?
> Thanks to you and Leonel for looking into this so quickly.
>
> On Sunday, 16 July 2017 21:34:40 UTC-5, Joe Barnhart wrote:
>>
>> Yes that fix looks exactly on point.
>>
>> -- Joe
>>
>> On Sunday, July 16, 2017 at 3:28:22 PM UTC-7, Leonel Câmara wrote:
>>>
>>> Joe the fix on the DAL wasn't for your problem, Your problem was fixed 
>>> in web2py here:
>>>
>>> https://github.com/web2py/web2py/pull/1686/commits/ce0b2557470ecb7c92719645293cb00785fe48bc
>>>
>>

-- 
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: Is a good practice add .table files to source control?

2017-07-21 Thread Bernardo Leon
You are right, maybe a development server and a production server could 
have different .table files but share the same model file. There is no 
problem for us to keep one of our versions with fake_migrate=True. Can we 
switch who is using migrate=True? What happens if both of us use 
migrate=True at the same time? Thank you!

El jueves, 20 de julio de 2017, 18:57:18 (UTC-5), Leonel Câmara escribió:
>
> I don't put the databases folder under source control. This way I can 
> update the in production version without worries. If you two are sharing 
> the same database in development, which I don't do in my team, then the 
> best is for one of you to always have migrations enabled with fake_migrate 
> True and the other one to have migrate True and fake_migrate False.  
>

-- 
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's the best way to use scheduler for a daily task?

2017-07-21 Thread Dave S


On Friday, July 21, 2017 at 12:29:47 PM UTC-7, Dave S wrote:
>
> On Friday, July 21, 2017 at 6:27:50 AM UTC-7, Rudy wrote:
>
>>
>> Another question: how to i associate tasks to a specific group? I seem to 
>> miss this in the doc
>>
>>
> I'd take a look at the scheduler tests -- Niphlod's default.py controller 
> at  
> https://github.com/niphlod/w2p_scheduler_tests>
> seems to have the detailed explanation around lines 600ff
>

On the other hand, if you only have a single task, groups seems to be 
unnecessary. 

/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: Page with four LOAD components is too slow

2017-07-21 Thread Bernardo Leon
It seems that you are right, I set up a virtual machine with 4gb ram only 
for the database and I ran the code along with redis on my laptop with 16gb 
ram and my times now are nearly the 600ms. I think it is good enough. 
Having some components that don't perform selects rendering only a simple 
html taking nearly 500ms is suspicious though.

Thank you Leonel! Using redis and assigning more RAM seems to be the best 
tips to improve the request performance (besides the book recommendations 
like lazy_tables, pool_size, extraction functions to modules, etc)

Just for curiosity, what are the hardware specs of your server? Thank you

El viernes, 21 de julio de 2017, 6:19:48 (UTC-5), Leonel Câmara escribió:
>
> Yes I'm pretty sure it's a RAM issue, 48 free MB is way too low. You 
> easily start having to use virtual memory with a couple of requests.   
>   
> To give you an idea, on a similar setup but a much better machine, I have 
> a much much more complex page than yours appears to be, with quite a lot of 
> ajax calls and complex db queries loading everything in 700ms.  
>

-- 
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's the best way to use scheduler for a daily task?

2017-07-21 Thread Dave S
On Friday, July 21, 2017 at 6:27:50 AM UTC-7, Rudy wrote:
>
> I want to clean up a table daily using schedule at midnight, I don't want 
> scheduler to poll too often to waste unnecessary resource. how should I do 
> it?
>

I'm pretty sure Niphlod will say (and has said), "Why bother?" -- the 
scheduler resources are pretty minimal when a task isn't running.

Just about everything except the heartbeat change seems like it will 
consume as much resources.

By the way, the 2.15.x builds had the "cron-like" queue option, which I'm 
looking forward to trying.
 

> 1) give heartbeat a large number in scheduler = Scheduler(db_sch, 
> heartbeat=7200)?
> 2) if len(db_sch().select(db_sch.scheduler_task.ALL)) == 0:
>  scheduler.queue_task(clear_curr_exch_cache, period=86400, 
> repeats=0)
> 3) create a cron job in linux to start the scheduler (python web2py.py -K 
> myapp -p 8002), another cron job to kill the process after a fixed period 
> of time
> 4) create a cron job to start the scheduler, call scheduler.terminate() 
> after db.commit() before return in the task action
> 5) combination of above
>
> Another question: how to i associate tasks to a specific group? I seem to 
> miss this in the doc
>
>
I'd take a look at the scheduler tests -- Niphlod's default.py controller 
at  
https://github.com/niphlod/w2p_scheduler_tests>
seems to have the detailed explanation around lines 600ff

/dps

Thank you!
>

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


Re: [web2py] Re: Help - Grid with left joins and sending arguments/variables to other functions

2017-07-21 Thread Jim Steil
I've certainly done that in the past as well.

Have a great weekend!

-Jim

On Fri, Jul 21, 2017 at 1:32 PM, 'Matthew J Watts' via web2py-users <
web2py@googlegroups.com> wrote:

> Ok thanks for your help Jim, i was getting confused - i introudced a bug
> into my app but all working fine now i moved all the code to a fresh app
>
> On Fri, Jul 21, 2017 at 3:51 PM, Jim Steil  wrote:
>
>> I'm assuming you're talking about a primary key made up of multiple
>> fields.  Is that correct.
>>
>> I've never done that, but I don't see how it would change anything other
>> than the 'left' setup.
>>
>> -Jim
>>
>> On Fri, Jul 21, 2017 at 5:54 AM, 'Matthew J Watts' via web2py-users <
>> web2py@googlegroups.com> wrote:
>>
>>>
>>> Hi, do you know if this is the same when i use primary keys of legacy
>>> tables - doesn't seem to be working when i change my tables to primary key.
>>> thanks
>>>
>>> On Wed, Jul 19, 2017 at 4:10 PM, Jim S  wrote:
>>>
 We were all there once.  Glad I was able to help.  Part of the beauty
 of web2py is the community and the friendly help you can get on this group.

 -Jim

 On Wednesday, July 19, 2017 at 9:26:08 AM UTC-5, Matthew J Watts wrote:
>
> Great thanks Jim, that did it for me - it's hard being a beginner!!
>
> On Wed, Jul 19, 2017 at 2:09 PM, Jim S  wrote:
>
>> I'd start first with changing this:
>>
>> links = [lambda ids: A('Download data set',_href=URL("default","down
>> load_dataset.csv",args=[ids.id]))]
>>
>> to this:
>>
>> links = [lambda ids: A('Download data set',_href=URL("default","down
>> load_dataset.csv",args=[ids.MAIN.id ]))]
>>
>> When you add the LEFT join you then need to specify which table to
>> get the field from.
>>
>> -Jim
>>
>>
>> On Wednesday, July 19, 2017 at 6:44:45 AM UTC-5, Matthew J Watts
>> wrote:
>>>
>>> Hi all
>>>
>>> I'm having some problems  trying to achieve the following
>>>
>>> I have a grid with left joins which selects a subset of entries in
>>> my database -(query between 3 tables)
>>>
>>>  i then want to be able to set up links within the grid that sends
>>> the id from each row (MAIN table) to a seperate function (another query
>>> between many tables).
>>>
>>> I then want to trigger a download 'csv' file.
>>>
>>> So far, I have managed to get this working if I use one table in the
>>> grid  (no left joins), however when i set up left joins within the 
>>> grid,i
>>> get an 'AttributeError' message. Somehow, by setting up the left
>>> joins, i loose the main id that i  want to send to the seperate 
>>> function -
>>> although i have set up  'field_id=db.MAIN.id '
>>> in the grid
>>>
>>> Here's the code:
>>>
>>> *Controller*
>>>
>>> def vec_dyn_query():
>>> links = [lambda ids: A('Download data
>>> set',_href=URL("default","download_dataset.csv",args=[ids.id]))]
>>> grid = SQLFORM.grid((db.MAIN),
>>> field_id=db.MAIN.id,
>>> left = [db.StudyLocation.on(db.MAIN.LocationID
>>> == db.StudyLocation.id), db.TAXON.on(db.MAIN.TaxonID == db.TAXON.id
>>> )],
>>> links=links,
>>> deletable=False, editable=False,
>>> details=False, selectable=False, create=False, csv=False)
>>> return locals()
>>>
>>> def download_dataset():
>>> main_id = request.args(0,cast=int)
>>> dataset = db(db.MAIN.id == request.args[0]).select()
>>> return dict(dataset=dataset)
>>>
>>> *Views*
>>>
>>> {{
>>> import cStringIO
>>> stream = cStringIO.StringIO()
>>> dataset.export_to_csv_file(stream)
>>> response.headers['Content-Type'] = 'text/csv'
>>> response.write(stream.getvalue(), escape=False)
>>> }}
>>>
>>> Note - if i take away the 'left = 
>>> [db.StudyLocation.on(db.MAIN.LocationID
>>> == db.StudyLocation.id), db.TAXON.on(db.MAIN.TaxonID == db.TAXON.id)],'
>>> Everything works fine
>>>
>>> Thanks for your help in advance
>>>
>>> Matt
>>>
>> --
>> 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 a topic in
>> the Google Groups "web2py-users" group.
>> To unsubscribe from this topic, visit https://groups.google.com/d/to
>> pic/web2py/pH_iiWr43UI/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> web2py+un...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>

Re: [web2py] Re: Help - Grid with left joins and sending arguments/variables to other functions

2017-07-21 Thread 'Matthew J Watts' via web2py-users
Ok thanks for your help Jim, i was getting confused - i introudced a bug
into my app but all working fine now i moved all the code to a fresh app

On Fri, Jul 21, 2017 at 3:51 PM, Jim Steil  wrote:

> I'm assuming you're talking about a primary key made up of multiple
> fields.  Is that correct.
>
> I've never done that, but I don't see how it would change anything other
> than the 'left' setup.
>
> -Jim
>
> On Fri, Jul 21, 2017 at 5:54 AM, 'Matthew J Watts' via web2py-users <
> web2py@googlegroups.com> wrote:
>
>>
>> Hi, do you know if this is the same when i use primary keys of legacy
>> tables - doesn't seem to be working when i change my tables to primary key.
>> thanks
>>
>> On Wed, Jul 19, 2017 at 4:10 PM, Jim S  wrote:
>>
>>> We were all there once.  Glad I was able to help.  Part of the beauty of
>>> web2py is the community and the friendly help you can get on this group.
>>>
>>> -Jim
>>>
>>> On Wednesday, July 19, 2017 at 9:26:08 AM UTC-5, Matthew J Watts wrote:

 Great thanks Jim, that did it for me - it's hard being a beginner!!

 On Wed, Jul 19, 2017 at 2:09 PM, Jim S  wrote:

> I'd start first with changing this:
>
> links = [lambda ids: A('Download data set',_href=URL("default","down
> load_dataset.csv",args=[ids.id]))]
>
> to this:
>
> links = [lambda ids: A('Download data set',_href=URL("default","down
> load_dataset.csv",args=[ids.MAIN.id ]))]
>
> When you add the LEFT join you then need to specify which table to get
> the field from.
>
> -Jim
>
>
> On Wednesday, July 19, 2017 at 6:44:45 AM UTC-5, Matthew J Watts wrote:
>>
>> Hi all
>>
>> I'm having some problems  trying to achieve the following
>>
>> I have a grid with left joins which selects a subset of entries in my
>> database -(query between 3 tables)
>>
>>  i then want to be able to set up links within the grid that sends
>> the id from each row (MAIN table) to a seperate function (another query
>> between many tables).
>>
>> I then want to trigger a download 'csv' file.
>>
>> So far, I have managed to get this working if I use one table in the
>> grid  (no left joins), however when i set up left joins within the grid,i
>> get an 'AttributeError' message. Somehow, by setting up the left
>> joins, i loose the main id that i  want to send to the seperate function 
>> -
>> although i have set up  'field_id=db.MAIN.id '
>> in the grid
>>
>> Here's the code:
>>
>> *Controller*
>>
>> def vec_dyn_query():
>> links = [lambda ids: A('Download data
>> set',_href=URL("default","download_dataset.csv",args=[ids.id]))]
>> grid = SQLFORM.grid((db.MAIN),
>> field_id=db.MAIN.id,
>> left = [db.StudyLocation.on(db.MAIN.LocationID
>> == db.StudyLocation.id), db.TAXON.on(db.MAIN.TaxonID == db.TAXON.id
>> )],
>> links=links,
>> deletable=False, editable=False,
>> details=False, selectable=False, create=False, csv=False)
>> return locals()
>>
>> def download_dataset():
>> main_id = request.args(0,cast=int)
>> dataset = db(db.MAIN.id == request.args[0]).select()
>> return dict(dataset=dataset)
>>
>> *Views*
>>
>> {{
>> import cStringIO
>> stream = cStringIO.StringIO()
>> dataset.export_to_csv_file(stream)
>> response.headers['Content-Type'] = 'text/csv'
>> response.write(stream.getvalue(), escape=False)
>> }}
>>
>> Note - if i take away the 'left = [db.StudyLocation.on(db.MAIN.LocationID
>> == db.StudyLocation.id), db.TAXON.on(db.MAIN.TaxonID == db.TAXON.id)],'
>> Everything works fine
>>
>> Thanks for your help in advance
>>
>> Matt
>>
> --
> 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 a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/to
> pic/web2py/pH_iiWr43UI/unsubscribe.
> To unsubscribe from this group and all its topics, 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 a topic in the
>>> Google Groups "web2py-users" group.
>>> 

[web2py] Is it possible to set Cache-Control: no-cache using @cache.action decorator?

2017-07-21 Thread Lisandro
Maybe my question is wrong because of some background that I'm not seeing.
Due to the structure of my app, I use @cache.action like this in all my 
controller functions:

@cache.action(cache_model=CACHE.model, time_expire=CACHE.time_expire, 
session=CACHE.session, vars=CACHE.vars, public=CACHE.public)
def index():
# code here

In my model, I define the CACHE object with the proper attributes, 
depending on several situations (logged in or not, certain permissions, 
specific scenarios). The thing is that, *in some cases I need to set the 
response headers as if I hadn't use @cache.action*. I've tried to set 
cache_model=None and time_expire=None, but it throws the following error:

Traceback (most recent call last):
  File "/home/gonguinguen/medios/gluon/restricted.py", line 227, in restricted
exec ccode in environment
  File "/home/gonguinguen/medios/applications/mazar/controllers/default.py", 
line 463, in 
  File "/home/gonguinguen/medios/gluon/globals.py", line 417, in 
self._caller = lambda f: f()
  File "/home/gonguinguen/medios/gluon/cache.py", line 669, in wrapped_f
'Expires': expires,
UnboundLocalError: local variable 'expires' referenced before assignment



I mean, if I dont use @cache.action, then Cache-Control header has the 
following value:
no-store, no-cache, must-revalidate, post-check=0, pre-check=0

But I can't generate that same response header using @cache.action.
Wouldn't be nice if we could pass time_expire=0 and cache_model=None to set 
those headers?

In anycase, how can I solve it? Would I need a custom decorator? Would it 
be possible to instantiate and rewrite the default cache.action behaviour?

Thanks in advance!
Regards,
Lisandro

-- 
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] passing additional variables in selectable function of sqlform.grid

2017-07-21 Thread Amit Kumar Modak
Hello,

I have created a form with sqlform.grid and added an additional 
sqlform.factory to the same form.
The sqlform.grid has a selectable function where I want to pass the value 
of sqlform.factory fields.

Please suggest how this can be done.

Regards,
Amit

-- 
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: Auth.signature not updating update_on

2017-07-21 Thread António Ramos
For this simple test

db.define_table('tab1',
Field('name'),
auth.signature
)

i got to admin and create a record
Initially the record is saved with modified_on as 2017-07-21 16:21:36

then via admin i edit the record and change name field and save.

The modified_on is still with 2017-07-21 16:21:36

Is this normal?

Regards

2017-06-27 16:40 GMT+01:00 Anthony :

> We probably need to see more code and an exact description of the workflow
> to make the update and check whether it was applied.
>
> Anthony
>
>
> On Tuesday, June 27, 2017 at 5:02:04 AM UTC-4, Ramos wrote:
>>
>> Yes anthony i meant modified_on ,not update_on
>>
>> I have this code
>>
>> table[id]=dict(field1=1,field2=2)
>>
>> the row is updated but the *modified_on* is not.
>>
>>
>> Regards
>>
>>
>> 2017-06-26 19:48 GMT+01:00 Anthony :
>>
>>> auth.signature includes a modified_on field, not an update_on field.
>>>
>>> Also, if you update a record by making changes to the row object and
>>> then calling row.update_record() (with no arguments), it will update the
>>> record with all the existing values (so modified_on will not be changed).
>>>
>>> Anthony
>>>
>>>
>>> On Monday, June 26, 2017 at 1:21:43 PM UTC-4, Ramos wrote:

 Hi,

 my table
 db.define_table(
 'entities',
 Field('uuid',length=64,default=lambda:str(uuid.uuid4())),
 Field('entity',required=True,label=T("Entity")),
 Field('description',label=T("Description"),default=""),
 Field('status', db.status),
 Field('type','reference dbentities',label=T("Type")),
 # Field('workflow','reference workflows',label="Workflow"),
 Field('event'),
 Field("last_error",default=""),
 Field('readers','list:string',default=[""]),
 auth.signature,
  format='%(entity)s',
 )
 the field *update_on* is not being updated  when i update a record via
 code.

 if i update a record via appadmin it does also not update *update_on*
 field

 Help :)

 thank you

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

2017-07-21 Thread Jim S
Only if you're using conditional models.

-Jim


On Thursday, July 20, 2017 at 6:00:45 PM UTC-5, Alex Glaros wrote:
>
> any performance advantage to moving controller files out of default.py 
> into their own file?
>

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


Re: [web2py] python Help with classes

2017-07-21 Thread Jim S
there is no *"isavailable"* 

Yes there is.  Did you paste the wrong result?   'isavailable' is True in 
the second result set too.

-Jim


On Friday, July 21, 2017 at 9:46:26 AM UTC-5, Ramos wrote:
>
> There is no traceback. the record is returned like this  if i remove  
> session=current.session
>
>  should send it to Approval', 'workflow': 4L, 'workflow_comment':  (workflow_comment.step = 8)>, 'titleenter': 'Review', 'title': 'Draft', 
> 'titleaction': 'Draft', 'entities_extra':  8)>, 'entities': , 'rgb': '#00c0ef', 'rules': 
> , 'details': 'Person', 'id': 8L,* 'isavailable': 
> True*, 'icon': 'fa-user', 'button': 'btn-info btn-xs', 'color': 
> 'bg-blue'}>
>
> but if i have 
> session=current.session inside the  *status_Draft*  function  i get this 
> result 
>
>
>  should send it to Approval', 'workflow': 4L, 'workflow_comment':  (workflow_comment.step = 8)>, 'titleenter': 'Review', 'title': 'Draft', 
> 'titleaction': 'Draft', 'entities_extra':  8)>, 'entities': , 'rgb': '#00c0ef', 'rules': 
> , 'details': 'Person', 'id': 8L, 'isavailable': True, 
> 'icon': 'fa-user', 'button': 'btn-info btn-xs', 'color': 'bg-blue'}>
>
> there is no *"isavailable"* 
>
> 2017-07-21 14:44 GMT+01:00 Anthony :
>
>> What is the traceback?
>>
>> --
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> ---
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to web2py+un...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

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


Re: [web2py] Re: Help - Grid with left joins and sending arguments/variables to other functions

2017-07-21 Thread Jim Steil
I'm assuming you're talking about a primary key made up of multiple
fields.  Is that correct.

I've never done that, but I don't see how it would change anything other
than the 'left' setup.

-Jim

On Fri, Jul 21, 2017 at 5:54 AM, 'Matthew J Watts' via web2py-users <
web2py@googlegroups.com> wrote:

>
> Hi, do you know if this is the same when i use primary keys of legacy
> tables - doesn't seem to be working when i change my tables to primary key.
> thanks
>
> On Wed, Jul 19, 2017 at 4:10 PM, Jim S  wrote:
>
>> We were all there once.  Glad I was able to help.  Part of the beauty of
>> web2py is the community and the friendly help you can get on this group.
>>
>> -Jim
>>
>> On Wednesday, July 19, 2017 at 9:26:08 AM UTC-5, Matthew J Watts wrote:
>>>
>>> Great thanks Jim, that did it for me - it's hard being a beginner!!
>>>
>>> On Wed, Jul 19, 2017 at 2:09 PM, Jim S  wrote:
>>>
 I'd start first with changing this:

 links = [lambda ids: A('Download data set',_href=URL("default","down
 load_dataset.csv",args=[ids.id]))]

 to this:

 links = [lambda ids: A('Download data set',_href=URL("default","down
 load_dataset.csv",args=[ids.MAIN.id ]))]

 When you add the LEFT join you then need to specify which table to get
 the field from.

 -Jim


 On Wednesday, July 19, 2017 at 6:44:45 AM UTC-5, Matthew J Watts wrote:
>
> Hi all
>
> I'm having some problems  trying to achieve the following
>
> I have a grid with left joins which selects a subset of entries in my
> database -(query between 3 tables)
>
>  i then want to be able to set up links within the grid that sends the
> id from each row (MAIN table) to a seperate function (another query 
> between
> many tables).
>
> I then want to trigger a download 'csv' file.
>
> So far, I have managed to get this working if I use one table in the
> grid  (no left joins), however when i set up left joins within the grid,i
> get an 'AttributeError' message. Somehow, by setting up the left
> joins, i loose the main id that i  want to send to the seperate function -
> although i have set up  'field_id=db.MAIN.id ' in
> the grid
>
> Here's the code:
>
> *Controller*
>
> def vec_dyn_query():
> links = [lambda ids: A('Download data
> set',_href=URL("default","download_dataset.csv",args=[ids.id]))]
> grid = SQLFORM.grid((db.MAIN),
> field_id=db.MAIN.id,
> left = [db.StudyLocation.on(db.MAIN.LocationID
> == db.StudyLocation.id), db.TAXON.on(db.MAIN.TaxonID == db.TAXON.id)],
> links=links,
> deletable=False, editable=False,
> details=False, selectable=False, create=False, csv=False)
> return locals()
>
> def download_dataset():
> main_id = request.args(0,cast=int)
> dataset = db(db.MAIN.id == request.args[0]).select()
> return dict(dataset=dataset)
>
> *Views*
>
> {{
> import cStringIO
> stream = cStringIO.StringIO()
> dataset.export_to_csv_file(stream)
> response.headers['Content-Type'] = 'text/csv'
> response.write(stream.getvalue(), escape=False)
> }}
>
> Note - if i take away the 'left = [db.StudyLocation.on(db.MAIN.LocationID
> == db.StudyLocation.id), db.TAXON.on(db.MAIN.TaxonID == db.TAXON.id)],'
> Everything works fine
>
> Thanks for your help in advance
>
> Matt
>
 --
 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 a topic in the
 Google Groups "web2py-users" group.
 To unsubscribe from this topic, visit https://groups.google.com/d/to
 pic/web2py/pH_iiWr43UI/unsubscribe.
 To unsubscribe from this group and all its topics, 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 a topic in the
>> Google Groups "web2py-users" group.
>> To unsubscribe from this topic, visit https://groups.google.com/d/to
>> pic/web2py/pH_iiWr43UI/unsubscribe.
>> To unsubscribe from this group and all its topics, 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)

Re: [web2py] python Help with classes

2017-07-21 Thread António Ramos
There is no traceback. the record is returned like this  if i remove
session=current.session

, 'titleenter': 'Review', 'title': 'Draft',
'titleaction': 'Draft', 'entities_extra': , 'entities': , 'rgb': '#00c0ef', 'rules':
, 'details': 'Person', 'id': 8L,* 'isavailable': True*,
'icon': 'fa-user', 'button': 'btn-info btn-xs', 'color': 'bg-blue'}>

but if i have
session=current.session inside the  *status_Draft*  function  i get this
result


, 'titleenter': 'Review', 'title': 'Draft',
'titleaction': 'Draft', 'entities_extra': , 'entities': , 'rgb': '#00c0ef', 'rules':
, 'details': 'Person', 'id': 8L, 'isavailable': True,
'icon': 'fa-user', 'button': 'btn-info btn-xs', 'color': 'bg-blue'}>

there is no *"isavailable"*

2017-07-21 14:44 GMT+01:00 Anthony :

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

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


Re: [web2py] python Help with classes

2017-07-21 Thread Anthony
What is the traceback?

-- 
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] what's the best way to use scheduler for a daily task?

2017-07-21 Thread Rudy
I want to clean up a table daily using schedule at midnight, I don't want 
scheduler to poll too often to waste unnecessary resource. how should I do 
it?
1) give heartbeat a large number in scheduler = Scheduler(db_sch, 
heartbeat=7200)?
2) scheduler.queue_task(clear_curr_exch_cache, period=86400, repeats=0)
3) create a cron job in linux to start the scheduler (python web2py.py -K 
myapp -p 8002), another cron job to kill the process after a fixed period 
of time
4) create a cron job to start the scheduler, call scheduler.terminate() 
after db.commit() before return in the task action
5) combination of above

Another question: how to i associate tasks to a specific group? I seem to 
miss this in the doc

Thank you!

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


Re: [web2py] python Help with classes

2017-07-21 Thread António Ramos
this is my real code in wf_validates.py


from gluon import current

class Validate(object):
def status(self,table,field,row,db):
wf=db.workflows(id=row[table]["workflow"])["workflow"]
if wf in ["Ficheiros","Load","Pessoa"]:
cb=getattr(eval("Ficheiros")(), "status"+"_"+"Draft")('xx','db')
return cb
else:
return ""

class Ficheiros(object):
def status_Draft(self,row,db):
db.log.insert(msg="status_draft")
*session=current.session*
this_time=datetime.datetime.utcnow()
+datetime.timedelta(hours=-1)#session.utc)
check_time=this_time.replace( hour=18, minute=0, second=0, microsecond=0 )
return this_time>check_time
return True



2017-07-21 13:53 GMT+01:00 António Ramos :

> yes i have
>
> from gluon import current
>
> in my wf_validates.py
>
> 2017-07-21 13:39 GMT+01:00 Anthony :
>
>> Do you have the following in your module:
>>
>> from gluon import current
>>
>> 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.
>>
>
>

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


Re: [web2py] python Help with classes

2017-07-21 Thread António Ramos
yes i have

from gluon import current

in my wf_validates.py

2017-07-21 13:39 GMT+01:00 Anthony :

> Do you have the following in your module:
>
> from gluon import current
>
> 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.
>

-- 
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] python Help with classes

2017-07-21 Thread Anthony
Do you have the following in your module:

from gluon import current

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: Page with four LOAD components is too slow

2017-07-21 Thread Leonel Câmara
Yes I'm pretty sure it's a RAM issue, 48 free MB is way too low. You easily 
start having to use virtual memory with a couple of requests.   
  
To give you an idea, on a similar setup but a much better machine, I have a 
much much more complex page than yours appears to be, with quite a lot of 
ajax calls and complex db queries loading everything in 700ms.  

-- 
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: Help - Grid with left joins and sending arguments/variables to other functions

2017-07-21 Thread 'Matthew J Watts' via web2py-users
Hi, do you know if this is the same when i use primary keys of legacy
tables - doesn't seem to be working when i change my tables to primary key.
thanks

On Wed, Jul 19, 2017 at 4:10 PM, Jim S  wrote:

> We were all there once.  Glad I was able to help.  Part of the beauty of
> web2py is the community and the friendly help you can get on this group.
>
> -Jim
>
> On Wednesday, July 19, 2017 at 9:26:08 AM UTC-5, Matthew J Watts wrote:
>>
>> Great thanks Jim, that did it for me - it's hard being a beginner!!
>>
>> On Wed, Jul 19, 2017 at 2:09 PM, Jim S  wrote:
>>
>>> I'd start first with changing this:
>>>
>>> links = [lambda ids: A('Download data set',_href=URL("default","down
>>> load_dataset.csv",args=[ids.id]))]
>>>
>>> to this:
>>>
>>> links = [lambda ids: A('Download data set',_href=URL("default","down
>>> load_dataset.csv",args=[ids.MAIN.id ]))]
>>>
>>> When you add the LEFT join you then need to specify which table to get
>>> the field from.
>>>
>>> -Jim
>>>
>>>
>>> On Wednesday, July 19, 2017 at 6:44:45 AM UTC-5, Matthew J Watts wrote:

 Hi all

 I'm having some problems  trying to achieve the following

 I have a grid with left joins which selects a subset of entries in my
 database -(query between 3 tables)

  i then want to be able to set up links within the grid that sends the
 id from each row (MAIN table) to a seperate function (another query between
 many tables).

 I then want to trigger a download 'csv' file.

 So far, I have managed to get this working if I use one table in the
 grid  (no left joins), however when i set up left joins within the grid,i
 get an 'AttributeError' message. Somehow, by setting up the left
 joins, i loose the main id that i  want to send to the seperate function -
 although i have set up  'field_id=db.MAIN.id ' in
 the grid

 Here's the code:

 *Controller*

 def vec_dyn_query():
 links = [lambda ids: A('Download data set',_href=URL("default","down
 load_dataset.csv",args=[ids.id]))]
 grid = SQLFORM.grid((db.MAIN),
 field_id=db.MAIN.id,
 left = [db.StudyLocation.on(db.MAIN.LocationID
 == db.StudyLocation.id), db.TAXON.on(db.MAIN.TaxonID == db.TAXON.id)],
 links=links,
 deletable=False, editable=False, details=False,
 selectable=False, create=False, csv=False)
 return locals()

 def download_dataset():
 main_id = request.args(0,cast=int)
 dataset = db(db.MAIN.id == request.args[0]).select()
 return dict(dataset=dataset)

 *Views*

 {{
 import cStringIO
 stream = cStringIO.StringIO()
 dataset.export_to_csv_file(stream)
 response.headers['Content-Type'] = 'text/csv'
 response.write(stream.getvalue(), escape=False)
 }}

 Note - if i take away the 'left = [db.StudyLocation.on(db.MAIN.LocationID
 == db.StudyLocation.id), db.TAXON.on(db.MAIN.TaxonID == db.TAXON.id)],'
 Everything works fine

 Thanks for your help in advance

 Matt

>>> --
>>> 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 a topic in the
>>> Google Groups "web2py-users" group.
>>> To unsubscribe from this topic, visit https://groups.google.com/d/to
>>> pic/web2py/pH_iiWr43UI/unsubscribe.
>>> To unsubscribe from this group and all its topics, 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 a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/web2py/pH_iiWr43UI/unsubscribe.
> To unsubscribe from this group and all its topics, 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: python Help with classes

2017-07-21 Thread António Ramos
any help ?

2017-07-20 22:45 GMT+01:00 António Ramos :

> hello i tested this simple code outside web2py
>
> class a():
> def a1(self):
> temp=getattr(eval("b")(), "b1")('testing result')
> return temp
>
> class b():
> def b1(self,param):
>* s=somevar2.somesubvar1*
> return param
>
> print a().a1()
>
>
> if i remove *s=somevar2.somesubvar1* the code prints "'testing result'"
> otherwise i get this error
> global name 'somevar2' is not defined
>
>
> I´m using this kind of code with virtual fields like this
> *db.py*
> from wf_validates import Validate
> db.define_table(
> "status",
> ...
> Field.Virtual('isavailable', lambda row: Validate().status('status','
> isavailable',row,db)),
>
> )
>
> *wf_validates.py*
>
> class Validate(object):
>
>
> def status(self,table,field,row,db):
> wf=db.workflows(id=row[table]["workflow"])["workflow"]
> cb=getattr(eval(wf)(), table+"_"+row[table]["title"].replace("
> ","_"))('xx',db)
> return cb
>
> class Ficheiros(object):
> def status_Draft(self,row,db):
> *session=current.session*
> return True
>
> here session=current.session is the offending line probably because
> session is not available.
> So far so good.
> The problem is that it does not throw any error and i was chasing it for
> too many time until i discovered it because the field "isavailable" was not
> created but the row object was created.
>
> Why web2py does not generate an admin error with
>
> *global name 'session' is not defined  ???*
>
> Regards
>
>
>
>
>
>
>
>
>
>
>

-- 
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.15.2 is OUT

2017-07-21 Thread tim . nyborg
Actually, this should be simple enough that I can post a fix.

On Friday, 21 July 2017 09:35:34 UTC+1, tim.n...@conted.ox.ac.uk wrote:
>
> Creating a SQLFORM.factory() from tables, or a combination of tables and 
> fields, now breaks, because the underlying logic assumes the tables are 
> fields:
>
> form = SQLFORM.factory(idb.catering, idb.catering_diet)
>
> File "/home/www-data/internal-apps/gluon/sqlhtml.py", line 1922, in factory
> return SQLFORM(DAL(None).define_table(table_name, *[field.clone() for 
> field in fields]),
> AttributeError: 'Table' object has no attribute 'clone'
>
>
> On Wednesday, 19 July 2017 13:25:52 UTC+1, Massimo Di Pierro wrote:
>>
>> web2py 2.15.2 is OUT is includes a few major bug fixes to version 2.15.1. 
>> Thanks Leonel for the quick fixes.
>> There a few other outstanding problems and they will be resolved in the 
>> next week.
>>
>> For new users 2.15.2 is still better than previous versions. For current 
>> users, please check it out and continue to report any problem. We want to 
>> make sure it is backward compatible as promised.
>>
>> 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.


[web2py] Re: web2py 2.15.2 is OUT

2017-07-21 Thread tim . nyborg
Creating a SQLFORM.factory() from multiple tables, or a combination of 
tables and fields, now breaks, because the underlying logic assumes the 
tables are fields:

form = SQLFORM.factory(idb.catering, idb.catering_diet)

File "/home/www-data/internal-apps/gluon/sqlhtml.py", line 1922, in factory
return SQLFORM(DAL(None).define_table(table_name, *[field.clone() for field 
in fields]),
AttributeError: 'Table' object has no attribute 'clone'


On Wednesday, 19 July 2017 13:25:52 UTC+1, Massimo Di Pierro wrote:
>
> web2py 2.15.2 is OUT is includes a few major bug fixes to version 2.15.1. 
> Thanks Leonel for the quick fixes.
> There a few other outstanding problems and they will be resolved in the 
> next week.
>
> For new users 2.15.2 is still better than previous versions. For current 
> users, please check it out and continue to report any problem. We want to 
> make sure it is backward compatible as promised.
>
> 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.