[web2py] Re: web2py 2.14.4 is OUT

2016-06-06 Thread Dave S


On Friday, June 3, 2016 at 9:30:10 AM UTC-7, PRACHI VAKHARIA wrote:
>
>
>
>
>
>
> *Great! What are some of the major updates in 2.14.4 – that we users 
> should note or be aware of?*
>
 
## 2.14.6

- Increased test coverage (thanks Richard)
- Fixed some newly discovered security issues in admin:
  CSRF vulnerability in admin that allows disabling apps
  Brute force password attack vulnerability in admin
  (thanks Narendra and Leonel)  

## 2.14.1-5

- fixed two major security issues that caused the examples app to leak 
information
- new Auth(…,host_names=[…]) to prevent host header injection
- improved scheduler
- pep8 enhancements
- many bug fixes
- restored GAE support that was broken in 2.13.*
- improved fabfile for deployment
- refactored examples with stupid.css
- new JWT implementation (experimental)
- new gluon.contrib.redis_scheduler
- myconf.get
- LDAP groups (experimental)
- .flash -> .w2p_flash
- Updated feedparser.py 5.2.1
- Updated jQuery 1.12.2
- welcome app now checks for version number
- Redis improvements. New syntax:

BEFORE:
from gluon.contrib.redis_cache import RedisCache
cache.redis = RedisCache('localhost:6379',db=None, debug=True)

NOW:
from gluon.contrib.redis_utils import RConn
from gluon.contrib.redis_cache import RedisCache
rconn = RConn()
# or RConn(host='localhost', port=6379,
# db=0, password=None, socket_timeout=None,
# socket_connect_timeout=None, .)
# exactly as a redis.StrictRedis instance
cache.redis = RedisCache(redis_conn=rconn, debug=True)

BEFORE:
from gluon.contrib.redis_session import RedisSession
sessiondb = RedisSession('localhost:6379',db=0, session_expiry=False)
session.connect(request, response, db = sessiondb)

NOW:
from gluon.contrib.redis_utils import RConn
from gluon.contrib.redis_session import RedisSession
rconn = RConn()
sessiondb = RedisSession(redis_conn=rconn, session_expiry=False)
session.connect(request, response, db = sessiondb)

Many thanks to Richard and Simone for their work and dedication.

-- 
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: MySQL connection error after scheduled task completes

2016-06-06 Thread Andre Kozaczka
 
Well. adding "sync_output=200" ended up working for tasks that were 
just over the 300 second mark (where previously I was failing). I changed 
the task length to 600 seconds and I'm back to failing. Ah... so close!!!

I tried changing sync_output to 100 but still failed. Unless you have 
another trick up your sleeve, I may have to wave the white flag and ditch 
MySQL and maybe give Postgres a try?

-Andre

-- 
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 edit the menu bar so as to remove profile and name in front of welcome in the dropdown?

2016-06-06 Thread Anthony
On Monday, June 6, 2016 at 2:45:00 PM UTC-4, Ron Chatterjee wrote:
>
> I get this error.
>
> EOL while scanning string literal: , line 1, pos 68
>
> While typing 
> navbar.element(_href=re.compile('register'))[0] = 'Registration Page"
>

Not sure how/why you are getting that error (hard to say without seeing all 
the code and the traceback). Of course, though, it will only work if the 
"register" item is in the navbar (which will only be the case if the user 
is *not* logged in).
 

> So, I am guessing, it looks for the work (pattern) 'register' and change 
> that to the 'registration page'.
>

Not exactly. It looks for the element whose _href attribute includes 
"register" in the URL (which is an anchor tag), and then it changes the 
first component of that element (which is the text displayed within the 
anchor tag).

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: Is there a way to make scheduler tasks be picked by workers up even quicker?

2016-06-06 Thread Anthony
On Monday, June 6, 2016 at 5:30:50 PM UTC-4, Niphlod wrote:
>
> okay but . 
> """
> Withimmediate=True you can force the check for new tasks: it will happen 
> at most as heartbeat seconds are passed
> """
> clearly states that "it" is "check for new tasks".
>

Yes, but earlier it says:

immediate=True it will force the main worker to reassign tasks.

So, you would assume that a "check for new tasks" results in the immediate 
assignment of such tasks. However, it sounds like even after a check for 
new tasks, there can still be a lag of several heartbeats before new tasks 
are actually assigned.

In the task lifecycle diagram, it might be helpful to show what kinds of 
lags to expect at each of the arrows (and what causes the lag, such as 
waiting for a set number of heartbeats or simply waiting for a worker to 
complete previously assigned tasks before it can get to the next one).

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: Output format of an SQL query

2016-06-06 Thread Anthony
On Monday, June 6, 2016 at 5:17:34 PM UTC-4, Sammy wrote:
>
> Oh sure, I understand the importance of define.table as a way to create 
> table if it does not exist already. But for existing tables, how is it that 
> an oracle client is able to understand the structure of a table to do 
> queries without further instructions but for DAL you need to explicitly 
> define it?
>

If you want to manually write your own SQL queries (being sure to avoid SQL 
injection) and then get back a standard database driver result set (i.e., a 
list of tuples), then there is no need to use the DAL at all. Just use the 
database driver, make a connection, and do things the way you want.

However, have a look at some of the DAL features: 
http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer. 
Then there is SQLFORM, SQLTABLE, and SQLFORM.grid, which make use of the 
DAL. If any of those features appeal to you, you might find it worth the 
effort to define DAL models representing your database tables. Without such 
models, the DAL wouldn't know enough about your database schema to enable 
all of that functionality. Futhermore, many attributes of the DAL models go 
beyond merely representing the database schema and provide additional 
information/functionality regarding your data models (e.g., validators, 
representation functions, form and grid labels, computation functions, file 
uploads, etc.).

Also, note that if you are starting with an existing database and need help 
constructing DAL model code based on your current database schema, you can 
use/adapt one of the scripts that come with web2py, such as 
https://github.com/web2py/web2py/blob/master/scripts/extract_oracle_models.py.

Anthony

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


[web2py] Re: Weird form issue

2016-06-06 Thread Mark Graves
Hey Jeff,

Most likely the date/time format.

If you can post a sample sqlite file and  SQLGRID code, happy to help.

-Mark


On Monday, June 6, 2016 at 12:42:16 PM UTC-7, Jeff Riley wrote:
>
> Sorry quick update.  Rows is returning information, so I must have a 
> problem with my javascript.  I still however cannot delete the record from 
> the SQLgrid view.
>
> On Monday, June 6, 2016 at 2:38:03 PM UTC-5, Jeff Riley wrote:
>>
>> Now I am truly confused.  I am able to submit the form and create the 
>> record in the database, but now 
>>
>> rows = db(db.training).select()  is not returning anything and I cannot 
>> delete the record from the SQLGrid view.  I have really wacked something up.
>>
>>
>> On Sunday, June 5, 2016 at 2:34:16 PM UTC-5, Jeff Riley wrote:
>>>
>>> Hello all.  I have built many forms in Web2py, but I clearly need 
>>> another set of eyes.  This form only works if I display every signal field 
>>> for some reason.  I am at a loss as to what I have set wrong.  I will add a 
>>> file with all the relevant code.  Thank you all very much for you help with 
>>> this.
>>>
>>

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


[web2py] Re: How to properly set cache.action parameters in order to have different cache for logged-in and not?

2016-06-06 Thread Niphlod
it's kinda chicken-and-egg here, because your real trouble is that the 
unlogged user hits a page that you want to be cached client-side as long as 
he is not logged in.
if you let it cache client-side, having the user returning to the same page 
to expect a different outcome is impossible. 
IMHO the solution is that you should refactor your app to present a proper 
"landing page" uri for public viewers and a separate one for logged in 
users. 

On Monday, June 6, 2016 at 7:10:51 PM UTC+2, Lisandro wrote:
>
> I've been doing some more test and a bit more reading about this, and I 
> can see (if I'm not wrong) that this is not a problem, it's the expected 
> behaviour.
> @cache.action does precisely that: it sets cache headers for client-side 
> caching, that is, browser side caching. 
> And, *optionally*, it allows you to set server-cache also (using a 
> cache.model, like ram, disk or redis).
>
> So, using @cache.action, the user (without being logged) visits a page and 
> the browser stores the view in cache. 
> Then the user logs in, and returns to the previously visited page, and the 
> browser uses the copy in local caché.
>
> I've read that I could use the old (but still perfectly valid) method of 
> @cache decorator.
> However @cache.action has some facilities to handle vars and session. wich 
> aren't present with @cache
>
>
> The whole point of this was to avoid an extra ajax call from the views.
> I was using the same cached view for all users, and the HTML returned to 
> the browser had an ajax call that loaded the user menu. 
> However. this meant that the models were executed twice per every page 
> visit, and that wasn't very good, also I'm trying to save CPU.
>
> I'll try to figure out if there is an alternative.
>
>
>
> El lunes, 6 de junio de 2016, 10:26:35 (UTC-3), Lisandro escribió:
>>
>> I need to decorate a controller function with @cache.action in order to 
>> have two different versions of the rendered view: one for logged-in users 
>> and another one for not logged-in users.
>>
>> Notice that I don't need one different caché for each user (that could be 
>> achieved using session argument). 
>> Instead, what I need is two versions of the rendered view: one for all 
>> the users that aren't logged-in, and one for all the users that are 
>> logged-in.
>> The only difference between those two versions of the rendered view is 
>> that one of them includes a top navbar, which is is the same for all 
>> logged-in users, but it shouldn't be present in the cache version for not 
>> logged-in users.
>>
>>
>> Because I need the same behaviour in several controller functions, the 
>> way I do it is defining the @cache.action parameters at the models level, 
>> like this:
>>
>> CACHE = Storage()
>> CACHE.prefix = ''
>> CACHE.time_expire = 300
>> CACHE.public = True
>> CACHE.session = False
>> CACHE.vars = False
>> if auth.is_logged_in():
>> CACHE.prefix += 'logged-in-'
>> CACHE.public = False
>> # CACHE.model = None
>>
>>
>> The I use that configuration in controller functions:
>>
>> @cache.action(time_expire=CACHE.time_expire, cache_model=CACHE.model, 
>> session=CACHE.session, vars=CACHE.vars, public=CACHE.public, prefix=CACHE
>> .prefix)
>> def index():
>> return response.render(...)
>>
>>
>> @cache.action(time_expire=CACHE.time_expire, cache_model=CACHE.model, 
>> session=CACHE.session, vars=CACHE.vars, public=CACHE.public, prefix=CACHE
>> .prefix)
>> def forum():
>> return response.render(...)
>>
>>
>>
>> However, I'm having trouble to make it work as I want. 
>> It's not working entirely wrong, but the problem is this:
>>   1) the user hits the index, without being logged-in;
>>   2) the user logs in
>>   3) the user goes back to index, but still sees the cached page (I think 
>> it's the browser that is using local cache). If the user reloads the page 
>> (hitting F5 or Ctrl+R), then the new view is shown.
>>
>>
>> What am I missing?
>>
>> As you can see in the code, I've tried:
>>  - setting public=False regardless of the logged in state;
>>  - setting cache.model=None when the user is logged-in;
>>  - using a different prefix for logged in users;
>>
>> But the problem remains: after logging in, the user need to hit F5 in 
>> order to see the other view.
>>
>>
>> As always, I will appreciate any help on this.
>> 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] Re: Output format of an SQL query

2016-06-06 Thread Niphlod
the oracle client really doesn't know anything about your database, it just 
spits what oracle has to tell.
DAL is an "Abstraction", so to "abstract" a model, it needs the definition 
(the brain that designed the oracle table had it, it just translated to SQL 
rather than python)

But let's put it in another way:

let your oracle client insert in a table a row and fetch the newly inserted 
id. Using DAL, you can just issue this

newly_inserted = db.table.insert(datetime_field=request.now, integer_field=2
)

or, fetch all rows pertaining to the current year, then for each line print 
a different column. Using DAL, you can just issue this

results = db(db.table.datetime_field.year() == 2016).select()
for row in results:
 print row.integer_field


Go ahead and as an exercise, use your oracle client: the goal is use less 
lines (and characters) than the aforementioned snippets (feel free to count 
the define_table statement too). 
Then count how many times you do CRUD operations in your app. Then multiply 
by the difference.
If the result is less than 100 lines, use db.executesql(). And you get no 
automatic representation of the result in a nice table, no grid, no 
smartgrid, and you locked your app's code to run on Oracle only.
If you need one of the above, or the result is more than 100 lines, join 
the "it's better to define a model for a database" world ^_^

On Monday, June 6, 2016 at 11:17:34 PM UTC+2, Sammy wrote:
>
> Oh sure, I understand the importance of define.table as a way to create 
> table if it does not exist already. But for existing tables, how is it that 
> an oracle client is able to understand the structure of a table to do 
> queries without further instructions but for DAL you need to explicitly 
> define 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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Python Social Auth - example site working with downlevel version of PSA

2016-06-06 Thread Donald McClymont
Sounds good - possibly worth trying to contact someone on the psa team as 
well.  I think we need to decide whether an updated plug-in is the best way 
to go or whether this should be a core part of either PSA or web2py.  The 
plug-in may be the quickest way forward but it might well be better to go 
another route as it reduces the risk of being back in the same situation we 
have now where changes in PSA mean the plug-in doesn't work with latest 
versions.

There was some previous dialogue on wihether python social auth or 
authomatic was the better approach and that did seem to come down in favour 
of PSA because authomatic was no longer being maintained. 

Donald

On Monday, June 6, 2016 at 12:30:29 AM UTC+1, Joe Barnhart wrote:
>
> Well I don't know about OAuth or auth-social, but I know web2py auth and I 
> know python pretty well.  I'll do a little reading on the whole concept of 
> social-auth and see if I can dig up more resources, like maybe the author 
> of w2p-social-auth.  If worse comes to worst, I can get some help from 
> Massimo.  I think a social auth plug-in that works really well would be not 
> only useful, but essential to web2py at this point.
>
> -- Joe
>
>
> On Sunday, June 5, 2016 at 3:08:23 PM UTC-7, Donald McClymont wrote:
>>
>> I would really like some progress on this - however I have extremely 
>> limited knowledge of both auth and Python Social Auth so was rather hoping 
>> someone that did might develop this in a better manner than I am likely to 
>> do..  I did briefly attempt to update what I have but quickly came to the 
>> conclusion it was not straightforward.  However I may have some time to 
>> look at in a bit more detail in the next few weeks.
>>
>> Regards
>> Donald
>>
>> On Sunday, June 5, 2016 at 1:20:38 AM UTC+1, Joe Barnhart wrote:
>>>
>>> Hi Donald --
>>>
>>> I find I need this too. The more recent version of social auth should 
>>> handle Google authentication in addition to Facebook and Twitter.  I need 
>>> these three in addition to web2py logon for my application. Have you seen 
>>> any progress on this front?  We may have to collaborate and do it ourselves.
>>>
>>> -- Joe
>>>
>>> On Monday, March 7, 2016 at 3:26:34 PM UTC-8, Donald McClymont wrote:

 I am sharing  an example site http://www.netdecisionmaking.com that 
 uses Python Social Auth for authentication, based on the following code 
 and 

 https://github.com/omab/python-social-auth and the web2py integration 
 developed at https://github.com/bnmnetp/w2p-social-auth 
 

 This works basically fine with the configured providers BUT it is using 
 python social auth version 0.1.26 and I am keen to get it moved to the 
 latest version.  Being keen but lazy I was looking to check if anyone has 
 got a more up to date version that is currently working as it seems there 
 are a few changes with the 0.2.x release that need to be worked through 
 and 
 w2p-social-auth that I am using has not been updated as far as I can find.

 The code for the site itself is at https://github.com/DonaldMcC/gdms 
 and I am using the recently add config file to determine an overall 
 authentication scheme for the site and pickup the keys etc which works 
 fine.
 Ideally I'd also like to also have the option to combine PSA and Web2py 
 login methods however I haven't really looked into that yet.

 Regards
 Donald

>>>

-- 
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 there a way to make scheduler tasks be picked by workers up even quicker?

2016-06-06 Thread Niphlod
okay but . 
"""
Withimmediate=True you can force the check for new tasks: it will happen at 
most as heartbeat seconds are passed
"""
clearly states that "it" is "check for new tasks".

A more-specific
"""
with immediate=True the worker will check for new tasks as soon as possible 
(without waiting 5 cycles). 
"""
to newbies could be more convoluted than the original statement...any 
suggestions ?

On Monday, June 6, 2016 at 2:05:12 PM UTC+2, Anthony wrote:
>
> On Monday, June 6, 2016 at 6:44:43 AM UTC-4, Niphlod wrote:
>
>> uhm. maybe it's not strictly clear but what immediate does is checking 
>> for new tasks (and the assigning/reassigning cycle) ASAP. There's no 
>> guarantee to do anything else (e.g. unavailable workers, single worker 
>> occupied processing a previous task, available workers but with a different 
>> group_name, etc).
>>
>> If you pinpoint the piece on the book that says they'll be picked up 
>> within hearbeat with immediate=True, we can review it
>>
>
> http://web2py.com/books/default/search/29?search=seconds+are+passed
>

-- 
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: MySQL connection error after scheduled task completes

2016-06-06 Thread Niphlod
I'm really not sure on how to tackle this mysql-specific shortcoming but I 
get the point. 
What does happen if you queue the task with sync_output=200 ? Functionaly 
you don't need it, but practically - but still in theory - it would 
short-circuit the issue keeping the connection alive every 200 seconds ...

On Monday, June 6, 2016 at 1:29:04 PM UTC+2, Andre Kozaczka wrote:
>
> In the "real" world, the task can take anywhere from 1 minute up to 30 
> minutes.
>
> In debugging my problem, I created a dummy task that would loop (sleep 15 
> seconds then do a db write) and end after a set period of time. I'm seeing 
> the problem when the dummy task takes over 300 seconds - anything less that 
> that the scheduler is able to update the task status after completion with 
> no errors.
>
> On Monday, June 6, 2016 at 6:31:40 AM UTC-4, Niphlod wrote:
>
>> how many seconds does it take to be executed ?
>>
>> On Monday, June 6, 2016 at 3:46:12 AM UTC+2, Andre Kozaczka wrote:
>>>
>>> I'm getting the following error after my scheduled task completes:
>>>
>>>
>>> Traceback (most recent call last): File 
>>> "/home/wdis/web2py/gluon/shell.py", line 273, in 
>>>run exec(python_code, _env) 
>>> File "", line 1, in  
>>> File "/home/wdis/web2py/gluon/scheduler.py", line 717, in loop 
>>>self.wrapped_report_task(task, self.async(task)) 
>>> File "/home/wdis/web2py/gluon/scheduler.py", line 874, in 
>>> wrapped_report_task 
>>>db.rollback() 
>>> File "/home/wdis/web2py/gluon/packages/dal/pydal/base.py", line 956, in 
>>> rollback 
>>>self._adapter.rollback() 
>>> File "/home/wdis/web2py/gluon/packages/dal/pydal/adapters/base.py", line 
>>> 1342, in rollback return self.connection.rollback()
>>> OperationalError: (2006, 'MySQL server has gone away')
>>>
>>>
>>>
>>> It appears that the db connection created by the scheduler (to update 
>>> the task status) gets stale and MySQL is closing it. I've tried adding 
>>> dummy reads to the database in my scheduled task code but it seems to have 
>>> no bearing on the db connection used by the scheduler.
>>>
>>> Any advice? I'm using PythonAnywhere so I can not change the timeout 
>>> setting for MySQL.
>>>
>>> -Andre
>>>
>>

-- 
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: Output format of an SQL query

2016-06-06 Thread Sammy
Oh sure, I understand the importance of define.table as a way to create 
table if it does not exist already. But for existing tables, how is it that 
an oracle client is able to understand the structure of a table to do 
queries without further instructions but for DAL you need to explicitly 
define 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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Output format of an SQL query

2016-06-06 Thread Dave S


On Monday, June 6, 2016 at 1:34:00 PM UTC-7, Sammy wrote:
>
> I will probably be picking this back up in a few weeks as I will be 
> sidetracked for a while. I am just curious though why web2py requires one 
> to define a table even if it already exists. e.g. if I have an Oracle 
> client installed, all I need is a connection string. I don't need to define 
> a model table locally before starting my sql queries. Why can't web2py do 
> the same? This sounds like extra work.
>
>
If you're only going to be using the DAL's "executesql" function, the model 
tables would be unnecessary.  But the DAL provides a lot more, including 
the select() function.  To use the select() function, the DAL needs to know 
the structure of the tables in the database.  That's what the model files 
tell it.  The DAL also provides a way to *create* tables in the database, 
and again uses the model files for that.  Not needed for existing tables, 
but for many projects web2py is used for, the database doesn't exist until 
we use web2py to create it.

/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: Output format of an SQL query

2016-06-06 Thread Sammy
I will probably be picking this back up in a few weeks as I will be 
sidetracked for a while. I am just curious though why web2py requires one 
to define a table even if it already exists. e.g. if I have an Oracle 
client installed, all I need is a connection string. I don't need to define 
a model table locally before starting my sql queries. Why can't web2py do 
the same? This sounds like extra work.




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

2016-06-06 Thread Jeff Riley
Sorry quick update.  Rows is returning information, so I must have a 
problem with my javascript.  I still however cannot delete the record from 
the SQLgrid view.

On Monday, June 6, 2016 at 2:38:03 PM UTC-5, Jeff Riley wrote:
>
> Now I am truly confused.  I am able to submit the form and create the 
> record in the database, but now 
>
> rows = db(db.training).select()  is not returning anything and I cannot 
> delete the record from the SQLGrid view.  I have really wacked something up.
>
>
> On Sunday, June 5, 2016 at 2:34:16 PM UTC-5, Jeff Riley wrote:
>>
>> Hello all.  I have built many forms in Web2py, but I clearly need another 
>> set of eyes.  This form only works if I display every signal field for some 
>> reason.  I am at a loss as to what I have set wrong.  I will add a file 
>> with all the relevant code.  Thank you all very much for you help with this.
>>
>

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


[web2py] Re: Weird form issue

2016-06-06 Thread Jeff Riley
Now I am truly confused.  I am able to submit the form and create the 
record in the database, but now 

rows = db(db.training).select()  is not returning anything and I cannot delete 
the record from the SQLGrid view.  I have really wacked something up.


On Sunday, June 5, 2016 at 2:34:16 PM UTC-5, Jeff Riley wrote:
>
> Hello all.  I have built many forms in Web2py, but I clearly need another 
> set of eyes.  This form only works if I display every signal field for some 
> reason.  I am at a loss as to what I have set wrong.  I will add a file 
> with all the relevant code.  Thank you all very much for you help with this.
>

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


[web2py] Re: How to edit the menu bar so as to remove profile and name in front of welcome in the dropdown?

2016-06-06 Thread Ron Chatterjee
I get this error.

EOL while scanning string literal: , line 1, pos 68

While typing 
navbar.element(_href=re.compile('register'))[0] = 'Registration Page"


So, I am guessing, it looks for the work (pattern) 'register' and change 
that to the 'registration page'. I printed out the navbar but I don't see 
the 'profile' anywhere. 


On Wednesday, June 1, 2016 at 12:12:31 PM UTC-4, Anthony wrote:
>
> You'd have to use server-side DOM manipulation:
>
> import re
> navbar = auth.navbar()
> navbar.element(_href=re.compile('register'))[0] = 'Registration Page"
>
> Or just take Massimo's advice and make a custom navbar.
>
> Anthony
>
> On Wednesday, June 1, 2016 at 11:45:13 AM UTC-4, rajjm...@gmail.com 
>  wrote:
>>
>> Thank you Anthony. See attached. Just want to change the wording of it 
>> but keep everything same and working the way they are.
>>
>>
>>
>> On Wednesday, June 1, 2016 at 7:55:19 AM UTC-4, Anthony wrote:
>>>
>>> On Wednesday, June 1, 2016 at 2:13:45 AM UTC-4, rajjm...@gmail.com 
>>> wrote:

 Yes. you are right. Just curious to know where Profile is defined like 
 in which html file? I can't seem to find that.

>>>
>>> Do you want to know where the auth dropdown menu is defined, or where 
>>> the actual Profile page is defined? Assuming you are talking about the 
>>> scaffolding application, the menu is created by auth.navbar() and is 
>>> included in layout.html. All of the Auth actions are handled via the user() 
>>> function in the default.py controller (and the associated 
>>> /views/default/user.html view).
>>>
>>> Note, it doesn't make sense to change "Profile" to "Register" in the 
>>> navbar. The way it works now is if the user is not logged in, the navbar 
>>> includes a link to "Register", and if the user is logged in, the navbar 
>>> instead includes a link to the "Profile" action (doesn't make sense for a 
>>> logged in user to register). If you do not want to expose the "profile" 
>>> action at all, you can instead add it to auth.settings.actions_disabled.
>>>
>>> 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: How to properly set cache.action parameters in order to have different cache for logged-in and not?

2016-06-06 Thread Lisandro
I've been doing some more test and a bit more reading about this, and I can 
see (if I'm not wrong) that this is not a problem, it's the expected 
behaviour.
@cache.action does precisely that: it sets cache headers for client-side 
caching, that is, browser side caching. 
And, *optionally*, it allows you to set server-cache also (using a 
cache.model, like ram, disk or redis).

So, using @cache.action, the user (without being logged) visits a page and 
the browser stores the view in cache. 
Then the user logs in, and returns to the previously visited page, and the 
browser uses the copy in local caché.

I've read that I could use the old (but still perfectly valid) method of 
@cache decorator.
However @cache.action has some facilities to handle vars and session. wich 
aren't present with @cache


The whole point of this was to avoid an extra ajax call from the views.
I was using the same cached view for all users, and the HTML returned to 
the browser had an ajax call that loaded the user menu. 
However. this meant that the models were executed twice per every page 
visit, and that wasn't very good, also I'm trying to save CPU.

I'll try to figure out if there is an alternative.



El lunes, 6 de junio de 2016, 10:26:35 (UTC-3), Lisandro escribió:
>
> I need to decorate a controller function with @cache.action in order to 
> have two different versions of the rendered view: one for logged-in users 
> and another one for not logged-in users.
>
> Notice that I don't need one different caché for each user (that could be 
> achieved using session argument). 
> Instead, what I need is two versions of the rendered view: one for all the 
> users that aren't logged-in, and one for all the users that are logged-in.
> The only difference between those two versions of the rendered view is 
> that one of them includes a top navbar, which is is the same for all 
> logged-in users, but it shouldn't be present in the cache version for not 
> logged-in users.
>
>
> Because I need the same behaviour in several controller functions, the way 
> I do it is defining the @cache.action parameters at the models level, like 
> this:
>
> CACHE = Storage()
> CACHE.prefix = ''
> CACHE.time_expire = 300
> CACHE.public = True
> CACHE.session = False
> CACHE.vars = False
> if auth.is_logged_in():
> CACHE.prefix += 'logged-in-'
> CACHE.public = False
> # CACHE.model = None
>
>
> The I use that configuration in controller functions:
>
> @cache.action(time_expire=CACHE.time_expire, cache_model=CACHE.model, 
> session=CACHE.session, vars=CACHE.vars, public=CACHE.public, prefix=CACHE.
> prefix)
> def index():
> return response.render(...)
>
>
> @cache.action(time_expire=CACHE.time_expire, cache_model=CACHE.model, 
> session=CACHE.session, vars=CACHE.vars, public=CACHE.public, prefix=CACHE.
> prefix)
> def forum():
> return response.render(...)
>
>
>
> However, I'm having trouble to make it work as I want. 
> It's not working entirely wrong, but the problem is this:
>   1) the user hits the index, without being logged-in;
>   2) the user logs in
>   3) the user goes back to index, but still sees the cached page (I think 
> it's the browser that is using local cache). If the user reloads the page 
> (hitting F5 or Ctrl+R), then the new view is shown.
>
>
> What am I missing?
>
> As you can see in the code, I've tried:
>  - setting public=False regardless of the logged in state;
>  - setting cache.model=None when the user is logged-in;
>  - using a different prefix for logged in users;
>
> But the problem remains: after logging in, the user need to hit F5 in 
> order to see the other view.
>
>
> As always, I will appreciate any help on this.
> 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.


Re: [web2py] Re: Ractive example

2016-06-06 Thread Richard Vézina
Where are we going?

I also didn't had any answer here :
https://groups.google.com/d/msg/web2py-developers/x23GReU0McM/5kX42ft-PAAJ

Thanks

Richard

On Fri, Apr 17, 2015 at 10:56 PM, Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:

> No. That simply decides wheher to display the login menu.
>
>
> On Thursday, 16 April 2015 13:41:03 UTC-5, Richard wrote:
>>
>> Hello Massimo,
>>
>> Are you really consider leaving authentication filtering of page elements
>> to ractive ({{#if (auth && auth.user)}} ...)?
>>
>> Richard
>>
>> On Wed, Apr 15, 2015 at 3:44 PM, Richard 
>> wrote:
>>
>>> If I understand to style and create a semantic ui form style I would
>>> have to create new layout and form template?
>>>
>>> forms.bs3.html -> forms.semntaic-ui.html
>>>
>>> ?
>>>
>>> Richard
>>>
>>>
>>> Le mercredi 15 avril 2015 15:30:40 UTC-4, Richard a écrit :

 Hello Massimo,

 I am looking at w3 right now... I have been able to make it works... I
 would like to know how your plan to integrate this into web2py... What it
 needs to be consider relatively stable for user to use it... Does your
 experiment is sufficiently well thought, it could be generalize and include
 in web2py core? Or could we start working on this bleeding edge concept to
 get away from server side form?

 I am want to help as much as I can in the coming days to make this in
 web2py core somehow soon...

 I will look to let someone use semantic ui as you point where we can
 help...

 Thanks

 Richard

 Le samedi 28 mars 2015 12:17:35 UTC-4, Massimo Di Pierro a écrit :
>
> yes it is orthogonal. In fact it uses very little of web2py, almost
> exclusively the DAL and marginally the web2py template language.
>
> On Thursday, 26 March 2015 02:48:05 UTC-5, Tim Richardson wrote:
>>
>>
>>
>> On Tuesday, 24 March 2015 13:55:25 UTC+11, Massimo Di Pierro wrote:
>>>
>>> Please look into this: https://github.com/mdipierro/w3
>>> I could very much use your opinions. I am working on it actively
>>> these days.
>>>


>> Massimo,
>> the w3 'project': it seems to be orthogonal to bootstrap3 support, so
>> in other words any widget changes won't have anything to do with ractive
>> support?
>> I'm a bit confused about the ambition for the use of ractive.
>> tim
>>
> --
>>> 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: Modification in version 2.14.6 not documented ?

2016-06-06 Thread Anthony
Issue submitted with proposed fix: 
https://github.com/web2py/web2py/issues/1351

On Monday, June 6, 2016 at 11:23:10 AM UTC-4, Anthony wrote:
>
> I see. With smartgrid, you can pass through any of the standard grid 
> parameters to the grid, and there is an option to specify any of those 
> parameters as a dictionary with table names as keys. The problem is that 
> the code simply checks whether each kwarg is a dictionary, assuming if it 
> is, it must be a dictionary whose keys are table names. However, some of 
> the parameters themselves are supposed to be dictionaries, as in this case, 
> so the code in question mistakenly deletes the parameter rather than 
> allowing it to pass through unchanged.
>
> Thanks for pointing this out. I'll file an issue.
>
> Anthony
>
> On Monday, June 6, 2016 at 8:57:58 AM UTC-4, omicron wrote:
>>
>> I want to believe you, but in version 2.13.4 the code for smatgrid is 
>> # filter out data info for displayed table
>> if table._tablename in constraints:
>> query = query & constraints[table._tablename]
>> if isinstance(links, dict):
>> links = links.get(table._tablename, [])
>> for key in 
>> 'columns,orderby,searchable,sortable,paginate,deletable,editable,details,selectable,create,fields'
>> .split(','):
>> if isinstance(kwargs.get(key, None), dict):
>> if table._tablename in kwargs[key]:
>> kwargs[key] = kwargs[key][table._tablename]
>> else:
>> del kwargs[key]
>> check = {}
>>
>> and in 2.14.6 I see :
>> # filter out data info for displayed table
>> if table._tablename in constraints:
>> query = query & constraints[table._tablename]
>> if isinstance(links, dict):
>> links = links.get(table._tablename, [])
>> for key in ('fields', 'field_id', 'left', 'headers', 'orderby', 
>> 'groupby', 'searchable',
>> 'sortable', 'paginate', 'deletable', 'editable', 
>> 'details', 'selectable',
>> 'create', 'csv', 'links', 'links_in_grid', 'upload', 
>> 'maxtextlengths',
>> 'maxtextlength', 'onvalidation', 'onfailure', 
>> 'oncreate', 'onupdate',
>> 'ondelete', 'sorter_icons', 'ui', 'showbuttontext', 
>> '_class', 'formname',
>> 'search_widget', 'advanced_search', 'ignore_rw', 
>> 'formstyle', 'exportclasses',
>> 'formargs', 'createargs', 'editargs', 'viewargs', 
>> 'selectable_submit_button',
>> 'buttons_placement', 'links_placement', 'noconfirm', 
>> 'cache_count', 'client_side_delete',
>> 'ignore_common_filters', 'auto_pagination', 
>> 'use_cursor'
>>):
>> if isinstance(kwargs.get(key, None), dict):
>> if table._tablename in kwargs[key]:
>> kwargs[key] = kwargs[key][table._tablename]
>> else:
>> del kwargs[key]
>> check = {}
>>
>> So, to hide the export buttons I must adapt my controller between this 2 
>> versions. If not, where i am wrong ?
>>
>> Le vendredi 3 juin 2016 22:11:46 UTC+2, Anthony a écrit :
>>>
>>> The documentation you quote is for SQLFORM.grid, but you are using 
>>> SQLFORM.smartgrid, which lets you use most of the grid parameters, but 
>>> within a dictionary keyed for each table of the smartgrid. Nothing has 
>>> changed.
>>>
>>> Anthony
>>>
>>> On Friday, June 3, 2016 at 3:33:36 PM UTC-4, omicron wrote:

 It's on smartgrid for my application

 Le vendredi 3 juin 2016 20:24:41 UTC+2, Niphlod a écrit :
>
> is this on grid or smartgrid ?
>
> On Friday, June 3, 2016 at 7:15:33 PM UTC+2, omicron wrote:
>>
>> I have just seen this modification for parameter 'exportclasses' in 
>> grids. The manual say "If you pass a dict like 
>> dict(xml=False, html=False)
>>
>> you will disable the xml and html export formats", but with the last 
>> version you must change you code to pass a dict like this 
>> dict(tablename = dict(xml=False, html=False))
>>
>>
>> And it's the same for other dicts options like "maxtextlength" for 
>> example.
>>
>>
>>

-- 
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: Modification in version 2.14.6 not documented ?

2016-06-06 Thread Anthony
I see. With smartgrid, you can pass through any of the standard grid 
parameters to the grid, and there is an option to specify any of those 
parameters as a dictionary with table names as keys. The problem is that 
the code simply checks whether each kwarg is a dictionary, assuming if it 
is, it must be a dictionary whose keys are table names. However, some of 
the parameters themselves are supposed to be dictionaries, as in this case, 
so the code in question mistakenly deletes the parameter rather than 
allowing it to pass through unchanged.

Thanks for pointing this out. I'll file an issue.

Anthony

On Monday, June 6, 2016 at 8:57:58 AM UTC-4, omicron wrote:
>
> I want to believe you, but in version 2.13.4 the code for smatgrid is 
> # filter out data info for displayed table
> if table._tablename in constraints:
> query = query & constraints[table._tablename]
> if isinstance(links, dict):
> links = links.get(table._tablename, [])
> for key in 
> 'columns,orderby,searchable,sortable,paginate,deletable,editable,details,selectable,create,fields'
> .split(','):
> if isinstance(kwargs.get(key, None), dict):
> if table._tablename in kwargs[key]:
> kwargs[key] = kwargs[key][table._tablename]
> else:
> del kwargs[key]
> check = {}
>
> and in 2.14.6 I see :
> # filter out data info for displayed table
> if table._tablename in constraints:
> query = query & constraints[table._tablename]
> if isinstance(links, dict):
> links = links.get(table._tablename, [])
> for key in ('fields', 'field_id', 'left', 'headers', 'orderby', 
> 'groupby', 'searchable',
> 'sortable', 'paginate', 'deletable', 'editable', 
> 'details', 'selectable',
> 'create', 'csv', 'links', 'links_in_grid', 'upload', 
> 'maxtextlengths',
> 'maxtextlength', 'onvalidation', 'onfailure', 
> 'oncreate', 'onupdate',
> 'ondelete', 'sorter_icons', 'ui', 'showbuttontext', 
> '_class', 'formname',
> 'search_widget', 'advanced_search', 'ignore_rw', 
> 'formstyle', 'exportclasses',
> 'formargs', 'createargs', 'editargs', 'viewargs', 
> 'selectable_submit_button',
> 'buttons_placement', 'links_placement', 'noconfirm', 
> 'cache_count', 'client_side_delete',
> 'ignore_common_filters', 'auto_pagination', 
> 'use_cursor'
>):
> if isinstance(kwargs.get(key, None), dict):
> if table._tablename in kwargs[key]:
> kwargs[key] = kwargs[key][table._tablename]
> else:
> del kwargs[key]
> check = {}
>
> So, to hide the export buttons I must adapt my controller between this 2 
> versions. If not, where i am wrong ?
>
> Le vendredi 3 juin 2016 22:11:46 UTC+2, Anthony a écrit :
>>
>> The documentation you quote is for SQLFORM.grid, but you are using 
>> SQLFORM.smartgrid, which lets you use most of the grid parameters, but 
>> within a dictionary keyed for each table of the smartgrid. Nothing has 
>> changed.
>>
>> Anthony
>>
>> On Friday, June 3, 2016 at 3:33:36 PM UTC-4, omicron wrote:
>>>
>>> It's on smartgrid for my application
>>>
>>> Le vendredi 3 juin 2016 20:24:41 UTC+2, Niphlod a écrit :

 is this on grid or smartgrid ?

 On Friday, June 3, 2016 at 7:15:33 PM UTC+2, omicron wrote:
>
> I have just seen this modification for parameter 'exportclasses' in 
> grids. The manual say "If you pass a dict like 
> dict(xml=False, html=False)
>
> you will disable the xml and html export formats", but with the last 
> version you must change you code to pass a dict like this 
> dict(tablename = dict(xml=False, html=False))
>
>
> And it's the same for other dicts options like "maxtextlength" for 
> example.
>
>
>

-- 
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: self referenced table - how to show description instead of internal id

2016-06-06 Thread Anthony
On Monday, June 6, 2016 at 9:19:10 AM UTC-4, Mirek Zvolský wrote:
>
> Thank you, Anthony!
> For me was important to be sure that I make no other mistake and proper 
> way to fix it is with delayed setting of represent=..
>
> Based on your answer, this works excellent for me:
> db.place.place_id.represent = lambda id, row: id and id.place or ""
>

No need to set the represent attribute after the table definition (and in 
fact, if you are using lazy tables, this de-lazifies the table). It's just 
a lambda function, which doesn't get called until some later point after 
the table has been defined.
 

> (handled for None + different parameters order)
>

Oops, fixed the parameter order in the original.

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: reading values from request.vars

2016-06-06 Thread Anthony
Looks like each set of inputs has the same input names, so you get back a 
list for each variable. I believe browsers preserve the order of input 
values for inputs with the same name, so you should be able to just run a 
loop and do a separate insert for each set of items in the lists (i.e., on 
the first loop, extract element [0] from each list, on the second loop, 
extract element [1], etc.).

Anthony

On Sunday, June 5, 2016 at 8:54:47 PM UTC-4, ktesr123...@gmail.com wrote:
>
> I am getting request.vars as shown below when I print it
>
> vars:  '1'], 'txt1': ['1', '1']}>
>
> these values are given as input from user interface and it has 2 rows, 
> each row has 3 dropdown and 1 text box
>
> now how do I read each item and insert into database, in the database 
> there is a table that has 4 columns, as per my requirement now it has to 
> insert 2 records in that table
>
> On Friday, June 3, 2016 at 2:21:48 PM UTC-6, Anthony wrote:
>
>> On Friday, June 3, 2016 at 12:35:49 PM UTC-4, ktesr...@gmail.com wrote:
>>>
>>> it is a single select, the values are populated from controller into a 
>>> view dynamically in jquery
>>>
>>
>> OK, so what's wrong with your current approach? What are you trying to 
>> achieve? Hard to help without seeing your code (e.g., model definitions, 
>> etc.). Also, why are you using .getlist for a variable that isn't a list, 
>> and then just extracting the first element (which you would get if not 
>> using .getlist)?
>>
>> Anthony
>>
>>
>>> On Friday, June 3, 2016 at 6:32:34 AM UTC-6, Anthony wrote:

 Hard to say because it's not clear (a) what kind of data are in opt1, 
 opt2, etc. (are they multi-select widgets producing lists or just single 
 selects?) and (b) how the form inputs map to your database fields.

 Anthony

 On Thursday, June 2, 2016 at 11:55:13 PM UTC-4, ktesr...@gmail.com 
 wrote:
>
> Anthony
>
> I wanted to iterate all the values from request.vars these values are 
> passed using ajax function from View, in the View each row will have 3 
> drop 
> downs and 1 textbox to take input from user
> there can be minimum 1 row. I am passing all the control names thru 
> ajax function
>
> View
> ===
> 
> /* jquery that builds html form written here */
>
> ajax('{{=URL('insert_data')}}',['opt1','opt2','opt3','txtt1'],'target'); 
> // opt1, opt2 and opt3 are dropdown control names and txt1 is the name if 
> textbox control all are html controls dynamically crated using jquery
>
> 
> 
> 
>
> Controller
> ==
> def insert_timesheet():
>  
>  orglist = request.vars.getlist("opt1")
>  response.flash = str(orgval)
>
>  ##db.Table.insert(field1=opt1[0],.)
>  return locals()
>
>
>
> On Thursday, June 2, 2016 at 7:34:04 PM UTC-6, Anthony wrote:
>
>> Please show some code and explain exactly what you want to do. To get 
>> a particular value from request.vars, just do 
>> request.vars.name_of_variable.
>>
>> Anthony
>>
>> On Thursday, June 2, 2016 at 8:07:13 PM UTC-4, ktesr...@gmail.com 
>> wrote:
>>>
>>> I am getting selected values from View to Controller using 
>>> request.vars
>>>
>>> I can see the values are coming as key value pair but not able to 
>>> figure out how to read each value and insert them in DB
>>>
>>>
>>>

-- 
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] How to properly set cache.action parameters in order to have different cache for logged-in and not?

2016-06-06 Thread Lisandro
I need to decorate a controller function with @cache.action in order to 
have two different versions of the rendered view: one for logged-in users 
and another one for not logged-in users.

Notice that I don't need one different caché for each user (that could be 
achieved using session argument). 
Instead, what I need is two versions of the rendered view: one for all the 
users that aren't logged-in, and one for all the users that are logged-in.
The only difference between those two versions of the rendered view is that 
one of them includes a top navbar, which is is the same for all logged-in 
users, but it shouldn't be present in the cache version for not logged-in 
users.


Because I need the same behaviour in several controller functions, the way 
I do it is defining the @cache.action parameters at the models level, like 
this:

CACHE = Storage()
CACHE.prefix = ''
CACHE.time_expire = 300
CACHE.public = True
CACHE.session = False
CACHE.vars = False
if auth.is_logged_in():
CACHE.prefix += 'logged-in-'
CACHE.public = False
# CACHE.model = None


The I use that configuration in controller functions:

@cache.action(time_expire=CACHE.time_expire, cache_model=CACHE.model, 
session=CACHE.session, vars=CACHE.vars, public=CACHE.public, prefix=CACHE.
prefix)
def index():
return response.render(...)


@cache.action(time_expire=CACHE.time_expire, cache_model=CACHE.model, 
session=CACHE.session, vars=CACHE.vars, public=CACHE.public, prefix=CACHE.
prefix)
def forum():
return response.render(...)



However, I'm having trouble to make it work as I want. 
It's not working entirely wrong, but the problem is this:
  1) the user hits the index, without being logged-in;
  2) the user logs in
  3) the user goes back to index, but still sees the cached page (I think 
it's the browser that is using local cache). If the user reloads the page 
(hitting F5 or Ctrl+R), then the new view is shown.


What am I missing?

As you can see in the code, I've tried:
 - setting public=False regardless of the logged in state;
 - setting cache.model=None when the user is logged-in;
 - using a different prefix for logged in users;

But the problem remains: after logging in, the user need to hit F5 in order 
to see the other view.


As always, I will appreciate any help on this.
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] Re: self referenced table - how to show description instead of internal id

2016-06-06 Thread Mirek Zvolský
Thank you, Anthony!
For me was important to be sure that I make no other mistake and proper way 
to fix it is with delayed setting of represent=..

Based on your answer, this works excellent for me:
db.place.place_id.represent = lambda id, row: id and id.place or ""
(handled for None + different parameters order)



Dne pondělí 6. června 2016 14:27:42 UTC+2 Anthony napsal(a):
>
> The "represent" attribute of the field cannot be set automatically in this 
> case because the table has not been defined at the time the field is 
> created. So you must set the "represent" attribute yourself:
>
> represent=lambda r, id: id.place
>
> 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: Modification in version 2.14.6 not documented ?

2016-06-06 Thread omicron
I want to believe you, but in version 2.13.4 the code for smatgrid is 
# filter out data info for displayed table
if table._tablename in constraints:
query = query & constraints[table._tablename]
if isinstance(links, dict):
links = links.get(table._tablename, [])
for key in 
'columns,orderby,searchable,sortable,paginate,deletable,editable,details,selectable,create,fields'
.split(','):
if isinstance(kwargs.get(key, None), dict):
if table._tablename in kwargs[key]:
kwargs[key] = kwargs[key][table._tablename]
else:
del kwargs[key]
check = {}

and in 2.14.6 I see :
# filter out data info for displayed table
if table._tablename in constraints:
query = query & constraints[table._tablename]
if isinstance(links, dict):
links = links.get(table._tablename, [])
for key in ('fields', 'field_id', 'left', 'headers', 'orderby', 
'groupby', 'searchable',
'sortable', 'paginate', 'deletable', 'editable', 
'details', 'selectable',
'create', 'csv', 'links', 'links_in_grid', 'upload', 
'maxtextlengths',
'maxtextlength', 'onvalidation', 'onfailure', 'oncreate'
, 'onupdate',
'ondelete', 'sorter_icons', 'ui', 'showbuttontext', 
'_class', 'formname',
'search_widget', 'advanced_search', 'ignore_rw', 
'formstyle', 'exportclasses',
'formargs', 'createargs', 'editargs', 'viewargs', 
'selectable_submit_button',
'buttons_placement', 'links_placement', 'noconfirm', 
'cache_count', 'client_side_delete',
'ignore_common_filters', 'auto_pagination', 'use_cursor'
   ):
if isinstance(kwargs.get(key, None), dict):
if table._tablename in kwargs[key]:
kwargs[key] = kwargs[key][table._tablename]
else:
del kwargs[key]
check = {}

So, to hide the export buttons I must adapt my controller between this 2 
versions. If not, where i am wrong ?

Le vendredi 3 juin 2016 22:11:46 UTC+2, Anthony a écrit :
>
> The documentation you quote is for SQLFORM.grid, but you are using 
> SQLFORM.smartgrid, which lets you use most of the grid parameters, but 
> within a dictionary keyed for each table of the smartgrid. Nothing has 
> changed.
>
> Anthony
>
> On Friday, June 3, 2016 at 3:33:36 PM UTC-4, omicron wrote:
>>
>> It's on smartgrid for my application
>>
>> Le vendredi 3 juin 2016 20:24:41 UTC+2, Niphlod a écrit :
>>>
>>> is this on grid or smartgrid ?
>>>
>>> On Friday, June 3, 2016 at 7:15:33 PM UTC+2, omicron wrote:

 I have just seen this modification for parameter 'exportclasses' in 
 grids. The manual say "If you pass a dict like 
 dict(xml=False, html=False)

 you will disable the xml and html export formats", but with the last 
 version you must change you code to pass a dict like this 
 dict(tablename = dict(xml=False, html=False))


 And it's the same for other dicts options like "maxtextlength" for 
 example.




-- 
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: Ajax load function div with incorrect data and duplicates elements of the page

2016-06-06 Thread isi_jca
Hi!!!

I commented that you can solve the problem by doing the following:

1°) Modifying the function as follows

def fgetlocalidad():
idprovincia = 0
result=''
idprovincia = int(request.vars.idprovincia)
localidad_rows = 
db(db.trlocalidad.idprovincia==idprovincia).select(orderby=db.trlocalidad.localidad_cp)
result = 'Localidad: '
result += ' '
for item in localidad_rows:
result += '' + item.localidad_cp 
+ ''  
result += ''
return XML(result)

2°) In the function def abmpersona():

define the url like this:

url=URL(c='persona',f='fgetlocalidad')

Modify the line where you call the function like this:

TR(TD( (LABEL("Provincia:",_class='control-label 
col-sm-3',_id='label_provincia'),
  
SELECT(_id="idprovincia",_class="idprovincia",_name="idprovincia",*[OPTION(i['descripcion'],
 
   _value=str(i['id'])) for i in 
provincia_row])),_onchange="ajax('%s' , ['idprovincia'], 'ciudad');" % 
url)),

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] self referenced table - how to show description instead of internal id

2016-06-06 Thread Anthony
The "represent" attribute of the field cannot be set automatically in this case 
because the table has not been defined at the time the field is created. So you 
must set the "represent" attribute yourself:

represent=lambda r, id: id.place

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: Is there a way to make scheduler tasks be picked by workers up even quicker?

2016-06-06 Thread Anthony
http://web2py.com/books/default/search/29?search=seconds+are+passed

-- 
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] self referenced table - how to show description instead of internal id

2016-06-06 Thread Mirek Zvolský
I have self refenced table for places (locations), ie. hierarchical 
structure of places is possible.

db.define_table('place',
Field('place', 'string'),
Field('place_id', 'reference place'),
format='%(place)s'
)

In Web2py grid for the parent place (place_id)
I see: place.id
But I want display: place.place

How could I achieve 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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: MySQL connection error after scheduled task completes

2016-06-06 Thread Andre Kozaczka
In the "real" world, the task can take anywhere from 1 minute up to 30 
minutes.

In debugging my problem, I created a dummy task that would loop (sleep 15 
seconds then do a db write) and end after a set period of time. I'm seeing 
the problem when the dummy task takes over 300 seconds - anything less that 
that the scheduler is able to finish just fine.

On Monday, June 6, 2016 at 6:31:40 AM UTC-4, Niphlod wrote:

> how many seconds does it take to be executed ?
>
> On Monday, June 6, 2016 at 3:46:12 AM UTC+2, Andre Kozaczka wrote:
>>
>> I'm getting the following error after my scheduled task completes:
>>
>>
>> Traceback (most recent call last): File 
>> "/home/wdis/web2py/gluon/shell.py", line 273, in 
>>run exec(python_code, _env) 
>> File "", line 1, in  
>> File "/home/wdis/web2py/gluon/scheduler.py", line 717, in loop 
>>self.wrapped_report_task(task, self.async(task)) 
>> File "/home/wdis/web2py/gluon/scheduler.py", line 874, in 
>> wrapped_report_task 
>>db.rollback() 
>> File "/home/wdis/web2py/gluon/packages/dal/pydal/base.py", line 956, in 
>> rollback 
>>self._adapter.rollback() 
>> File "/home/wdis/web2py/gluon/packages/dal/pydal/adapters/base.py", line 
>> 1342, in rollback return self.connection.rollback()
>> OperationalError: (2006, 'MySQL server has gone away')
>>
>>
>>
>> It appears that the db connection created by the scheduler (to update the 
>> task status) gets stale and MySQL is closing it. I've tried adding dummy 
>> reads to the database in my scheduled task code but it seems to have no 
>> bearing on the db connection used by the scheduler.
>>
>> Any advice? I'm using PythonAnywhere so I can not change the timeout 
>> setting for MySQL.
>>
>> -Andre
>>
>

-- 
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 there a way to make scheduler tasks be picked by workers up even quicker?

2016-06-06 Thread Niphlod
even in a single process you shouldn't notice any "unresponsiveness". it's 
most likely that locally you have both the browser process and webp2y 
competing for resources than a problem on the thread executing the work (as 
the default webserver is multi-threaded). Another thing to consider with 
ajax is that by default web2py serializes session access, so you may be 
experiencing a delay from when you queue the task to when it gets really 
executed, but it still won't be noticeable in the web page requesting it 
(still, consider using session.forget(response) at the top of your 
controller receiving the ajax req if you don't need session).

On Saturday, June 4, 2016 at 2:02:18 AM UTC+2, Mark Smith wrote:
>
> I just tried switching to a simple ajax call and like you said and it's 
> much faster (and there's no unresponsiveness :) ) on pythonanywhere. When I 
> test it locally I see a bit of unresponsiveness but I think that's because 
> pythonanywhere has webworkers while locally there's only a single 
> non-threaded web2py process?
>
> Thanks for all the help Niphlod! Really appreciate 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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Is there a way to make scheduler tasks be picked by workers up even quicker?

2016-06-06 Thread Niphlod
uhm. maybe it's not strictly clear but what immediate does is checking for 
new tasks (and the assigning/reassigning cycle) ASAP. 
There's no guarantee to do anything else (e.g. unavailable workers, single 
worker occupied processing a previous task, available workers but with a 
different group_name, etc).

If you pinpoint the piece on the book that says they'll be picked up within 
hearbeat with immediate=True, we can review it

On Friday, June 3, 2016 at 10:18:47 PM UTC+2, Anthony wrote:
>
>
>>
> The documentation claims tasks will be picked up within one heartbeat with 
> immediate=True, though in this case it looks like it's taking at least 
> three heartbeats. Is that to be expected unless using redis, in which case, 
> we should update the docs?
>
> 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: error starting scheduler: error retreiving status

2016-06-06 Thread Niphlod
nope. what it really happens is that scheduler module "register itself" 
under the current namespace. When you do -K , it just spawns a process that 
executes "from gluon import current;current._scheduler.loop()" in the 
context of the app.
Given that DAL under the hood represents a connection, and that a 
connection can't be serialized, that connection can only be used in the 
outer-scope, and another one, for the inner scope, is initiated to support 
operations in that thread. 
The only safe way to do that is to build a connection with the same URI, 
but that DOESN'T reexecute all the models, hence your issue.

On Friday, June 3, 2016 at 11:09:18 PM UTC+2, Bart wrote:
>
> Thanks Niphlod, It works!
>
> I added 
> self.db_thread.executesql("set search_path to scheduler, auth, ... ;")
> in gluon/scheduler.py
> after the self.db_thread = DAL(  line and before the 
> self.define_tables( ... line
>
> I am aware of the fact that it is not supported, but the database uses a 
> strict schema policy so i don't have a choice really.
>
> I am wondering how worker startup works when the python web2py.py -K 
> myapp statement is executed.
> How does the scheduler get the database uri, if the models aren't executed 
> at scheduler worker startup?
> Does scheduler only search for de db - DAL(... statement, omitting the 
> other code?
>
> Op vrijdag 3 juni 2016 20:24:01 UTC+2 schreef Niphlod:
>>
>> the scheduler though doesn't know anything about the search path when it 
>> rebuilds its own model... that's why setting search_path is undocumented ^_^
>>
>> you can try fiddling with the source of the scheduler (along these lines 
>> https://github.com/web2py/web2py/blob/master/gluon/scheduler.py#L948) to 
>> set the same search path.
>>
>> Please be aware that even if it seems to work, support for it is not 
>> assured (so use at your own risk)
>>
>> On Friday, June 3, 2016 at 7:19:02 PM UTC+2, Bart wrote:
>>>
>>> Hi Niphlod,
>>>
>>> Normally i just put a record in the scheduler_task table with appadmin. 
>>> That works fine (no errors), but nothing happens because the scheduler 
>>> worker is not running.
>>>
>>> In db.py the database schema is set via db.executesql("set search_path 
>>> to auth,scheduler, ... ;")
>>>
>>> In case migrate is True, the search_path is set to scheduler, auth, ... 
>>> just before the scheduler = Scheduler(db) statement.
>>>
>>>
>>>
>>> Op vrijdag 3 juni 2016 18:35:07 UTC+2 schreef Niphlod:

 what happens when you try to queue a task from the app ? AFAIK I'd be 
 eager to know how can it work if there is no "public" schema, unless you 
 tinkered with scheduler's table definitions

 On Friday, June 3, 2016 at 4:57:23 PM UTC+2, Bart wrote:
>
> Addition:
>
> I am using several schema's in the postgres database.
>
> The scheduler tables are in schema 'scheduler'
>
> Schema 'public' does not exist.
>
> Can this cause the problem?
>


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


[web2py] Re: MySQL connection error after scheduled task completes

2016-06-06 Thread Niphlod
how many seconds does it take to be executed ?

On Monday, June 6, 2016 at 3:46:12 AM UTC+2, Andre Kozaczka wrote:
>
> I'm getting the following error after my scheduled task completes:
>
>
> Traceback (most recent call last): File 
> "/home/wdis/web2py/gluon/shell.py", line 273, in 
>run exec(python_code, _env) 
> File "", line 1, in  
> File "/home/wdis/web2py/gluon/scheduler.py", line 717, in loop 
>self.wrapped_report_task(task, self.async(task)) 
> File "/home/wdis/web2py/gluon/scheduler.py", line 874, in 
> wrapped_report_task 
>db.rollback() 
> File "/home/wdis/web2py/gluon/packages/dal/pydal/base.py", line 956, in 
> rollback 
>self._adapter.rollback() 
> File "/home/wdis/web2py/gluon/packages/dal/pydal/adapters/base.py", line 
> 1342, in rollback return self.connection.rollback()
> OperationalError: (2006, 'MySQL server has gone away')
>
>
>
> It appears that the db connection created by the scheduler (to update the 
> task status) gets stale and MySQL is closing it. I've tried adding dummy 
> reads to the database in my scheduled task code but it seems to have no 
> bearing on the db connection used by the scheduler.
>
> Any advice? I'm using PythonAnywhere so I can not change the timeout 
> setting for MySQL.
>
> -Andre
>

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