[web2py] Re: scheduled task ignoring period

2017-04-25 Thread Dave S
On Tuesday, April 25, 2017 at 9:34:48 AM UTC-7, James Holstead wrote: > > I have a scheduler.py in my models directory with two functions, > syncUsers, testAdd > > # create scheduler > myScheduler = Scheduler(db, migrate=False, tasks=dict(myfunc=syncUsers)) > > #myScheduler = Scheduler(db,

[web2py] Re: How can jQuery() pick up the change date

2017-04-25 Thread Anthony
On Tuesday, April 25, 2017 at 12:26:50 PM UTC-4, Rudy wrote: > > Hi Anthony, > > Thanks for your suggestion, below script alert("heeheehee") only got > triggered when i moved the cursor in the textbox, edited the date > -mm-dd manually, then moved the cursor to another field. > > after I

[web2py] scheduled task ignoring period

2017-04-25 Thread James Holstead
I have a scheduler.py in my models directory with two functions, syncUsers, testAdd # create scheduler myScheduler = Scheduler(db, migrate=False, tasks=dict(myfunc=syncUsers)) #myScheduler = Scheduler(db, migrate=False, tasks=dict(myfunc=testAdd)) # sync user task once a day

[web2py] Re: How can jQuery() pick up the change date

2017-04-25 Thread Rudy
Hi Anthony, Thanks for your suggestion, below script alert("heeheehee") only got triggered when i moved the cursor in the textbox, edited the date -mm-dd manually, then moved the cursor to another field. after I modified to .on("input"), alert("xxyyy") only got triggered when I again

Re: [web2py] Re: How can I union 2 different table datasets?

2017-04-25 Thread Richard Vézina
In case .grid() is a requirement and schema is frozen, the best option would be to make the union in the backend (postgres) with a view (index it as describe in the SO explain for better performance) and create a db models for the view in web2py which it can only be selected as it is a view. I am

Re: [web2py] Re: btw: great job

2017-04-25 Thread Richard Vézina
+1 I am eager to see what Massimo's future web2py spin off framework will offer... I was insecur about web2py future recently as Massimo didn't seems as active as before, but I guess he focus his efforts over the future framework which is a great news. Richard On Mon, Apr 24, 2017 at 5:02 PM,

Re: [web2py] Re: How can I union 2 different table datasets?

2017-04-25 Thread Richard Vézina
Is there a major issue that prevent us to use SQLFORM.grid like crud.select() where you can pass a query instead of a talbe?? Richard On Tue, Apr 25, 2017 at 11:45 AM, Richard Vézina < ml.richard.vez...@gmail.com> wrote: > Yes, you are right, he can use SQLTABLE or build his grid with helper >

[web2py] quesAn idea to speed up web2py in production

2017-04-25 Thread JorgeH
Hello I've just had an idea that came to mind. But I'm unsure of its feasability. Can a script be made with pytest ( or something similar ) , and with the 'code coverage ' feature, get automatically only the functions that are being imported and used in models and controllers, So in

Re: [web2py] Re: How can I union 2 different table datasets?

2017-04-25 Thread Richard Vézina
Yes, you are right, he can use SQLTABLE or build his grid with helper though... Richard On Tue, Apr 25, 2017 at 11:23 AM, Anthony wrote: > On Tuesday, April 25, 2017 at 10:39:53 AM UTC-4, Richard wrote: >> >> Forgot to mention... If you for some reason you can't refactor

Re: [web2py] Re: How can I union 2 different table datasets?

2017-04-25 Thread Anthony
On Tuesday, April 25, 2017 at 10:39:53 AM UTC-4, Richard wrote: > > Forgot to mention... If you for some reason you can't refactor your > schema... you can unionize query in web2py like so : > > select_cat = db(db.cat.id>0).select() > > select_dog = db(db.dog.id>0).select() > > select_cat_and_dog

Re: [web2py] Re: How can I union 2 different table datasets?

2017-04-25 Thread Richard Vézina
Forgot to mention... If you for some reason you can't refactor your schema... you can unionize query in web2py like so : select_cat = db(db.cat.id>0).select() select_dog = db(db.dog.id>0).select() select_cat_and_dog = select_cat | select_dog Note: You can use & or | they are python binary

[web2py] Re: SQLFfor,.grid export query

2017-04-25 Thread Anthony
The approach mentioned in that post regarding checking for request.vars._export_type seems like the way to go. If you are having problems, please post your code and the exact errors you are getting. Anthony On Monday, April 24, 2017 at 9:36:19 AM UTC-4, Yebach wrote: > > Hello > > I would like

[web2py] Re: How can I union 2 different table datasets?

2017-04-25 Thread Anthony
On Tuesday, April 25, 2017 at 10:10:08 AM UTC-4, A3 wrote: > > Maybe you can use: > > db.define_table(‘animal’, > > Field('name', 'string', length=45), > > Field(‘age’, ‘integer’), > > Field(‘apt_time’,’datetime’) > > > and then subclass: > > > db.define_table(‘cat’, db.animal) > > and > >

[web2py] Error when trying to use Google Cloud SQL

2017-04-25 Thread Jonathan Tomm
I'm struggling to get a basic test app deployed to Google App Engine using Cloud SQL. 1. I cloned web2py of github two days ago. 2. I created a Google Cloud SQL instance. 3. I created a new sample app called "SQL" using the web2py admin interface. 4. On the new app, I changed the following

[web2py] Re: Open uploaded files in some editor.

2017-04-25 Thread Anthony
web2py doesn't have anything built in for this. You could use one of the many Javascript based rich text editors (Quill, ProseMirror, CKEditor, TinyMCE, Trix, etc.). From the web2py side, in a controller, you would have to read the file content and provide it to the editor, and once changes are

[web2py] Re: SQLFORM.grid question

2017-04-25 Thread Anthony
On Tuesday, April 25, 2017 at 3:20:23 AM UTC-4, Jim Russell wrote: > > I worked around this by setting the wltype field to string and adding > a requires=IS_IN_SET. This makes the editing page have a dropdown with the > set members instead of a free-form text field. > This is not a great idea

[web2py] Re: SQLFORM.grid question

2017-04-25 Thread Anthony
On Tuesday, April 25, 2017 at 12:18:29 AM UTC-4, Jim Russell wrote: > > Hi all. > > I'm having an issue with an SQLFORM.gird query. I have a table where one > of the columns references another table. Here are the table definitions: > > db.define_table('osrwhitelistpool', > Field('id',

[web2py] Re: How can jQuery() pick up the change date

2017-04-25 Thread Anthony
Does it get triggered when the field loses focus? How about if you use .on("input", ...) instead of .on("change", ...)? Anthony On Tuesday, April 25, 2017 at 6:01:12 AM UTC-4, Rudy wrote: > > Hi there, > > I tried to generate a CREATE FORM using below, then in my view, I added a > script

[web2py] Re: How can I union 2 different table datasets?

2017-04-25 Thread A3
Maybe you can use: db.define_table(‘animal’, Field('name', 'string', length=45), Field(‘age’, ‘integer’), Field(‘apt_time’,’datetime’) and then subclass: db.define_table(‘cat’, db.animal) and db.define_table(‘dog’, db.animal) and then query on db.animal ? -- Resources: -

Re: [web2py] Re: How can I union 2 different table datasets?

2017-04-25 Thread Richard Vézina
Hello George, You don't need to do that (which is called materialized view and it's not suppose to involve the creation a new table that you need to maintain in sync : http://stackoverflow.com/questions/3986366/how-to-create-materialized-views-in-sql-server)... In MSSQL you will have

[web2py] Re: How can I union 2 different table datasets?

2017-04-25 Thread Anthony
If all or most of the fields are the same from one table to the other, why not simply put everything in a single table with "category" field to distinguish cats and dogs (create an index on that field to make it faster to query just cats or just dogs)? Anthony On Tuesday, April 25, 2017 at

[web2py] Re: force redirect after expiration login session expiration time

2017-04-25 Thread Anthony
I would put the timeout value directly in the JS, as in your second example. To redirect, just set the value of location: location = [logout url]; Anthony On Tuesday, April 25, 2017 at 9:57:31 AM UTC-4, A3 wrote: > > > Anthony your right, I was just looking in the wrong direction. > > What

[web2py] Re: SQLFORM.grid without advanced search

2017-04-25 Thread Anthony
On Tuesday, April 25, 2017 at 4:49:41 AM UTC-4, Gael Princivalle wrote: > > I can certainly do it finding the file that create this line. > Someone knows which file is it? > > jQuery('#w2p_query_fields').change();jQuery('#w2p_query_panel').slideDown > (); > If you want to take that approach, you

[web2py] Re: force redirect after expiration login session expiration time

2017-04-25 Thread A3
Anthony your right, I was just looking in the wrong direction. What about something like: def index(): timeout = auth.settings.expiration return dict( timeout=timeout) or put the variable timeout in the layout directly to simplify. And in the layout var timeout = {{=timeout}};

[web2py] Re: SQLFORM.grid without advanced search

2017-04-25 Thread Anthony
SQLFORM.grid(..., advanced_search=False) More generally, the "searchable" argument can be a callable that executes a custom search, and the "search_widget" argument can be a callable that generates a custom search widget for the UI. With the combination of those two arguments, you can create

[web2py] Re: Python 2.7 mock library and web2py

2017-04-25 Thread Robin Bryce
Sorry, I missed your reply. I do not have modules/db.py I was attempting to mock the definition of 'ldap_auth' in models/db.py (It's not essential that the definition live there.) It looks like when the tests/sign_infra.py mock is applied for "db.ldap_auth", the web2py custom import hook

[web2py] Re: How can I union 2 different table datasets?

2017-04-25 Thread George D Elig
I have a working solution for this. I created a third table, which reads the rows from each cat and dog table and then inserts the values as new rows into the new table. That table is then passed into SQLFORM.grid(). It's not pretty, but it works while I continue to look for a more elegant

[web2py] How can jQuery() pick up the change date

2017-04-25 Thread Rudy
Hi there, I tried to generate a CREATE FORM using below, then in my view, I added a script trying to change the renew_date when an user changes the start_date by using .change(function()). jQuery could detect the change if I manually modified the date in the textbook, but not when I chose a

[web2py] Re: SQLFORM.grid without advanced search

2017-04-25 Thread Gael Princivalle
I can certainly do it finding the file that create this line. Someone knows which file is it? jQuery('#w2p_query_fields').change();jQuery('#w2p_query_panel').slideDown(); It doesn't matter if it'll delete this slidedown for all the application grids. Il giorno lunedì 24 aprile 2017 11:28:03

[web2py] Re: SQLFORM.grid question

2017-04-25 Thread Jim Russell
I worked around this by setting the wltype field to string and adding a requires=IS_IN_SET. This makes the editing page have a dropdown with the set members instead of a free-form text field. So it's working, but it's not the most elegant solution. -- Resources: - http://web2py.com -