[web2py] Re: Custom Login View

2017-03-24 Thread Happy Rob
SOLVED Hi Marlysson Thanks for your help In the end I didn't need to do any defining or anything too much. For 1 (failed login), I put the auth settings into the controller instead of the model For 2. (selecting login page) I also put the auth settings into the controller For 3. (logout) I

[web2py] Displaying data of same date from two tables

2017-03-24 Thread Nabil Ontour
Hi, I want to create some small accounting program and am having some issue with creating a proper balance view. I have 2 tables, one for incomes and one for expenditures, each with the corresponding money and the date of data entry: db.incomes.income_USD db.incomes.calendar_date db.expenditur

[web2py] Re: How to make Web2py not block 'get' as well as 'post' requests from external sources?

2017-03-24 Thread Anthony
Is this in a Cordova/Phonegap app? If so, you may need to whitelist the web2py URL and set a content security policy. See https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-whitelist/. Otherwise, if it is a cross-origin request, you need to set up CORS to allow it. Anthony On

[web2py] Re: validate_and_update what am I missing???

2017-03-24 Thread Anthony
On Friday, March 24, 2017 at 11:15:35 AM UTC-4, wdtnh wrote: > > Trying to to get the following working but for some reason getting a can't > use keyword in expression error. > Just like .update(), it should be .validate_and_update(Mobile=mobile, ...). > It's also my understanding that valida

[web2py] RestApi

2017-03-24 Thread PK
@request.restful() def api(): response.view = 'generic.json' def GET(*args,**vars): patterns = [ "/wishBoxes[wishBoxes]", "/wishBoxes[wishBoxes]/{wishBoxes.name.startswith}", "/boxes[Details]/{Details.Title_id}" ] parser = db.p

[web2py] Re: Extracting values of a list from the database and using them individually in a javascript array

2017-03-24 Thread Dave S
On Tuesday, March 21, 2017 at 11:18:21 AM UTC-7, Massimo Di Pierro wrote: > > def form1Details(): > form = db.compForm(request.args(0)) > forms = db(db.compFormPages.formName==form.id > ).select(db.compFormPages.ALL) > images = [{'link':URL('download',args=form.formImage), > 'title':

[web2py] Re: xml() error when BEAUTIFY globals()

2017-03-24 Thread Lars
I went for something even simpler : I bypass BEAUTIFUL.. I just wanted a view with everything named : def my_beautify(component): t = TABLE() if isinstance(component, dict): for k, v in component.iteritems(): if v is None or isinstance(v, (bool, str)):

Re: [web2py] Re: web2pyslices

2017-03-24 Thread Richard Vézina
For db, we can use sqlite in memory, so we don't have to keep db file with model already defined that could make the app heavy... Oups you mention it in the last sentence... Richard On Fri, Mar 24, 2017 at 11:43 AM, Carlos Costa wrote: > About fiddle, I think we can easily do the view and cont

[web2py] Re: web2pyslices

2017-03-24 Thread Carlos Costa
About fiddle, I think we can easily do the view and controller part. But what about the other parts like models, modules, database, etc? Would it be really necessary or have a reliable solution? I think we could do only view, controller and model. For the model maybe we should have an interface to

[web2py] Re: web2pyslices

2017-03-24 Thread Carlos Costa
What about this: http://www.web2pyref.com/ Who owns it? Could we migrate slices data to it? Em terça-feira, 21 de março de 2017 16:53:16 UTC-3, Massimo Di Pierro escreveu: > > web2pyslices is becoming hard to maintain. Right now the best solution is > to create a github repo and move all the rec

[web2py] Re: inner join taking too long

2017-03-24 Thread Marlysson Silva
Show up some error on web2py's console? Em segunda-feira, 20 de março de 2017 13:05:12 UTC-3, John Philip escreveu: > > Hi there, > > I have two tables that I have queried using an inner join the query > outputs about 50,000 + records this is no problem on sqlite however it does > not seem to lo

Re: [web2py] Re: xml() error when BEAUTIFY globals()

2017-03-24 Thread Richard Vézina
Thanks Anthony, clearer than my explanation. Richard On Thu, Mar 23, 2017 at 7:08 PM, Anthony wrote: > BEAUTIFY is not designed to take the entire global environment. The > problem is that globals() includes all of the web2py HTML helper classes. > Because BEAUTIFY is itself an HTML helper, it

Re: [web2py] lazy_tables + 'reference tablename' = referenced table not lazy

2017-03-24 Thread Richard Vézina
I want also share I little tricks I found... I had some globals id represent variables that I reuse in many part of the app... I know globals vars is bad idea, but it the only way I found to make things DRY and fast (caching those vars in redis) instead of redoing the same query over and over to re

[web2py] validate_and_update what am I missing???

2017-03-24 Thread wdtnh
Trying to to get the following working but for some reason getting a can't use keyword in expression error. It's also my understanding that validate_and_update should include fields that have actually changed??? Since this would be coming in as an ajax request, I'd rather not go through a bun

Re: [web2py] lazy_tables + 'reference tablename' = referenced table not lazy

2017-03-24 Thread Richard Vézina
Thanks for your answer Joe... My problem though is not quite that I don't want to define linked table, but avoid define tables that should be lazy as they are not required in the context of a given html request... I have over 150 tables in my app (some should be merged as one as they exist cause o

[web2py] Re: How to make Web2py not block 'get' as well as 'post' requests from external sources?

2017-03-24 Thread Marlysson Silva
What's happening? Em sexta-feira, 24 de março de 2017 11:10:23 UTC-3, Mike Stephenson escreveu: > > $().ready(function () { > var url = 'http://biglibrary.pythonanywhere.com/app/phonegap/temp.json'; > > $.get(url, function (data) { >alert(data); > }); > }); > -- Resources: - http://web2

Re: [web2py] Re: web2pyslices

2017-03-24 Thread Richard Vézina
That what I thought, but I wasn't so sure as I never used gitter... So let fucos over web2py-fiddle if there is some taker to make such thing happen... Richard On Thu, Mar 23, 2017 at 6:15 PM, Anthony wrote: > There is also another things that could be done, as we had discussed that >> in the

Re: [web2py] Call a javascript function from SQLFORM.smartgrid

2017-03-24 Thread 'FERNANDO VILLARROEL' via web2py-users
Dear Nico. Thank you for you answer. I use a sqlform.smart grid for show records from database, i want to do a call Restful for show especific record clicked using ajax My problem is i not know how i implement onclick function on sqlform.smart grid Regards On Friday, March 24, 2017 6:20 AM,

[web2py] How to make Web2py not block 'get' as well as 'post' requests from external sources?

2017-03-24 Thread Mike Stephenson
$().ready(function () { //here any https will work but below is not working because of cross origin ..code is correct, just change url or put some json string or file var url = 'http://biglibrary.pythonanywhere.com/app/phonegap/temp.json'; $.get(url, function (data) { alert(data); }); })

[web2py] Re: Custom Login View

2017-03-24 Thread Marlysson Silva
1. By analysing the web2py's code I find this line: https://github.com/web2py/web2py/blob/master/gluon/tools.py#L1520 Basically you should define a url to redirect when login fails. And internally açthe parameter ( next=??) that you want to do. https://github.com/web2py/web2py/blob/master/gluo

[web2py] Should I modify response.headers in order to get nginx's uwsgi_cache work properly?

2017-03-24 Thread Lisandro
I'm running a web2py website with public articles, and there are ocasional peaks in traffic. I use Nginx as a webserver, and uWsgi to run my web2py application. Considering the articles are public (the HTML page of an article is the same for every visitor), I'm already doing some caching in ord

[web2py] Call a javascript function from SQLFORM.smartgrid

2017-03-24 Thread Nico de Groot
A client-side javascript function can't be triggered by a link. You can define a onclick attribute containing a call to a javascript function. If you want to use a row id as a parameter you have to make it available as a data attribute. It's not clear what you want and why. Maybe you have to gr

[web2py] Re: Extracting values of a list from the database and using them individually in a javascript array

2017-03-24 Thread Cypher
gracias Massimo On Tuesday, March 21, 2017 at 8:18:21 PM UTC+2, Massimo Di Pierro wrote: > > def form1Details(): > form = db.compForm(request.args(0)) > forms = db(db.compFormPages.formName==form.id > ).select(db.compFormPages.ALL) > images = [{'link':URL('download',args=form.formI