[web2py] I am trying to change the background image every 5 seconds like this but this doesn't seem to work?

2016-06-13 Thread Emmanuel Dsouza
CONTROLLER: def retimage(): k=["URL('static','images/1.jpg')","URL('static','images/2.jpg')","URL('static','images/3.jpg')"] from random import randint i=randint(0,2) return k[i] def index(): return locals() VIEW: {{extend 'layout.html'}} window.setInterval(function(){

Re: [web2py] I am trying to change the background image every 5 seconds like this but this doesn't seem to work?

2016-06-13 Thread Massimiliano
In *k* you have strings like “URL(‘static’,’images/1.jpg’)” not the URL func result. Try something like that: def retimage(): from random import randint i=randint(0,2) return URL(‘static’,’images/%d.jpg’ % (i)) On Mon, Jun 13, 2016 at 11:30 AM, Emmanuel Dsouza wrote: > CONTROLLER

Re: [web2py] I am trying to change the background image every 5 seconds like this but this doesn't seem to work?

2016-06-13 Thread Emmanuel Dsouza
I am getting: name 'retimage' is not defined On Monday, June 13, 2016 at 3:17:15 PM UTC+5:30, Massimiliano wrote: > > In *k* you have strings like “URL(‘static’,’images/1.jpg’)” not the URL > func result. > > Try something like that: > > def retimage(): > from random import randint > i=ra

Re: [web2py] I am trying to change the background image every 5 seconds like this but this doesn't seem to work?

2016-06-13 Thread Emmanuel Dsouza
My update code: def retimage(): from random import randint i=randint(0,2) return URL('static','images/%d.jpg' %(i)) def index(): return dict(retimage=retimage) {{extend 'layout.html'}} window.setInterval(function(){ {{getimage=retimage()}} document.body.backg

[web2py] Re: what is syntax for recursive join?

2016-06-13 Thread Niphlod
once you establish how a record gets tagged as "it has no children" you break from the loop. That being said DON'T use recursive selects for an adjacency listyou don't want to loose control over how many queries you launch. If you need, rebuild the structure in python from a single select,

[web2py] Re: orderby with foreign key

2016-06-13 Thread Niphlod
there's no way around join(ing) theexternal table, use the external table column to sort and select only from the first table. On Sunday, June 12, 2016 at 7:51:17 AM UTC+2, Tribo Eila wrote: > > hi, > > using: for x in db(..).select(.. orderby=db.yyy.zzz): > row.append(TD(x.zzz.k

[web2py] How to add a Facebook like to a field in a db table, such that 1 like increases it by one?

2016-06-13 Thread Steve Joe
How do I code 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

Re: [web2py] I am trying to change the background image every 5 seconds like this but this doesn't seem to work?

2016-06-13 Thread Massimiliano
You can’t call directly a function defined in controller… Try to define retimage in a model file. It should work. On Mon, Jun 13, 2016 at 11:53 AM, Emmanuel Dsouza wrote: > My update code: > > def retimage(): > from random import randint > i=randint(0,2) > return URL('static','ima

[web2py] Moving auth_user and related tables to another schema

2016-06-13 Thread Johann Spies
We use PostgreSQL and make use of schemas for most of our work and use the "rname" option to do that in normal table definition. I have looked through the source code of tools.py and cannot see where it can be done to let the auth-related tables be created in a different schema than 'public'. Ho

Re: [web2py] Moving auth_user and related tables to another schema

2016-06-13 Thread Richard Vézina
As far as I know web2py only support public schema, though as you mention I think can support other schema with rname... You mention to use it that way, it not working with auth if you create custom auth table model definition? Richard On Mon, Jun 13, 2016 at 10:04 AM, Johann Spies wrote: > W

[web2py] Size of SQLFORM.grid items

2016-06-13 Thread Jitun John
Above is a simple SQL.grid I have used. I added "headers={'store_log_stats.cluster_name' : 'Cluster__Name'}," to make sure that the column

[web2py] Re: How to add a Facebook like to a field in a db table, such that 1 like increases it by one?

2016-06-13 Thread Ron Chatterjee
http://www.web2py.com/books/default/chapter/29/11/jquery-and-ajax?search=vote#Voting-and-rating On Monday, June 13, 2016 at 7:27:03 AM UTC-4, Steve Joe wrote: > > How do I code it? > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (S

[web2py] Re: Size of SQLFORM.grid items

2016-06-13 Thread Anthony
As per the documentation: - maxtextlength sets the maximum length of text to be displayed for each field value, in the grid view. This value can be overwritten for each field using maxtextlengths, a dictionary of 'tablename.fieldname':length e.g. {'auth_user.email' : 50} Anthony

[web2py] Re: I am trying to change the background image every 5 seconds like this but this doesn't seem to work?

2016-06-13 Thread Anthony
You cannot call Python functions on the server from Javascript code running in the browser. The following line: {{getimage=retimage()}} will be called exactly once on the server *before *the HTML page is ever sent to the browser, and it will not result in anything being written into the Ja

[web2py] Re: SELECT without duplicates for a specific field

2016-06-13 Thread Gael Princivalle
New model: db.define_table('categories): Field('title', type='string')) db.define_table('products'): Field('code', type='string'), Field('category', reference 'categories')) With groupby I obtain a good result. results = db(db.products).select(db.products.category, groupby=db.pro

[web2py] JANRAIN

2016-06-13 Thread LC LC
Hi, janrain works for different providers but il does not run for google+. i ve created an id auth client Could you explain me the different steps to run google authentification Thank you NB: in my model i have : auth.settings.login_form = RPXAccount(request

[web2py] Re: JANRAIN

2016-06-13 Thread Anthony
It works for me, though I'm using an older version of web2py's Janrain adapter (not sure if that matters). How have you configured your app on Janrain? Anthony On Monday, June 13, 2016 at 12:14:57 PM UTC-4, LC LC wrote: > > Hi, > janrain works for different providers but il does not run for goo

[web2py] Unable to run web2py_no_console.exe (v2.14.6)

2016-06-13 Thread Arglanir
Hello everyone, I just unpacked the last version into an empty folder. Then I try to launch using a command line: - web2py_no_console.exe - web2py_no_console.exe -p 8003 - web2py_no_console.exe -p 8003 -i 0.0.0.0 - web2py_no_console.exe -p 8003 -i 0.0.0.0 -a -l web2py.log -d

[web2py] is it safe to create url in javascript?

2016-06-13 Thread Alex Glaros
the only way I could get fancyTree to work was with "source url" parmeter below. Is that a safe way to create a url and send it a dict item? (Crontroller view_tree works with: request.get_vars.specificTaxonomyFK) // Initialize Fancytree $("#alexTree").fancytree({ checkbox: true, selectMode: 3, s

Re: [web2py] is it safe to create url in javascript?

2016-06-13 Thread Richard Vézina
I not sure it safe or not, but it surely not portable... let say you app is not at port 8000... use web2py to build you url using URL() helper and you just have to assign the output of URL() to a js var something like that : var url = {{=URL(c=controller, args=args, vars=vars)}} then source: {u

Re: [web2py] is it safe to create url in javascript?

2016-06-13 Thread Richard Vézina
You may need URL(..., scheme=True) depending if fancytree is picky or not... On Mon, Jun 13, 2016 at 4:44 PM, Richard Vézina wrote: > I not sure it safe or not, but it surely not portable... let say you app > is not at port 8000... > > use web2py to build you url using URL() helper and you just

[web2py] OperationalError: no such column

2016-06-13 Thread Marty Jones
Hi - I created a custom auth_user table with a new field ('company') and am having trouble accessing it in my controller: db.py db.define_table( auth.settings.table_user_name, Field('first_name', length=128, default=''), Field('last_name', length=

Re: [web2py] is it safe to create url in javascript?

2016-06-13 Thread Alex Glaros
thanks for reminding me to update it Richard. this worked: var my_url = "{{=URL(c='default/view_tree.json', vars=dict(specificTaxonomyFK=specificTaxonomyFK))}}"; source: {url: my_url}, -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2

[web2py] Pure HTML form

2016-06-13 Thread Jeff Riley
Hello all. So sorry to bother you again. Since I have to overlay form fields on top of a canvas, I have to build pure HTML form elements (at least that is all I can think to do). My problem is when I submit the form I am getting errors in form even though I am filling out every field. I am

[web2py] Re: Pure HTML form

2016-06-13 Thread Dave S
On Monday, June 13, 2016 at 4:27:20 PM UTC-7, Jeff Riley wrote: > > Hello all. So sorry to bother you again. Since I have to overlay form > fields on top of a canvas, I have to build pure HTML form elements (at > least that is all I can think to do). My problem is when I submit the form > I

[web2py] Re: OperationalError: no such column

2016-06-13 Thread Dave S
On Monday, June 13, 2016 at 1:57:38 PM UTC-7, Marty Jones wrote: > > Hi - > > I created a custom auth_user table with a new field ('company') and am > having trouble accessing it in my controller: > The book recommends using auth.settings.extra_fields http://web2py.com/books/default/chapter/29

[web2py] Re: is it safe to create url in javascript?

2016-06-13 Thread Stuart Rolinson
Embedding URLs is generally not a problem as long as you are not including any particular server information. You should ensure that your server side code is secure and validates the input / parameters it receives. If the user is logged in for this function call you could user @auth.requires_l

[web2py] Re: OperationalError: no such column

2016-06-13 Thread Marty Jones
OK - I reverted to auth.settings.extra_fields and expanded the code shown below. The same error is persisting. db.py # -*- coding: utf-8 -*- # ## This scaffolding model makes your app work on Google App Engine too ## File is

Re: [web2py] Re: Pure HTML form

2016-06-13 Thread Jeff Riley
Dave thank you. I will check this out and see. As far as errors I am just getting the pop-up with no field showing issues. Which I am assuming is because the Web2py Ajax does not handle html form elements. Thank you, Jeff Riley > On Jun 13, 2016, at 6:47 PM, Dave S wrote: > > > >> On Monda

[web2py] Re: OperationalError: no such column

2016-06-13 Thread Dave S
On Monday, June 13, 2016 at 5:49:35 PM UTC-7, Marty Jones wrote: > > OK - I reverted to auth.settings.extra_fields and expanded the code shown > below. The same error is persisting. > What do the entries in yourapp/databases/sql.log say about the table schema? /dps -- Resources: - http://

[web2py] Re: OperationalError: no such column

2016-06-13 Thread Marty Jones
Resolved it - the line that was triggering the error: company = db.auth_user.company) should have been: company = auth.user.company) :P On Monday, June 13, 2016 at 9:03:39 PM UTC-4, Dave S wrote: > > > > On Monday, June 13, 2016 at 5:49:35 PM UTC-7, Marty Jones wrote: >> >> OK - I reverted to

[web2py] Re: OperationalError: no such column

2016-06-13 Thread Dave S
On Monday, June 13, 2016 at 6:11:56 PM UTC-7, Marty Jones wrote: > > Resolved it - the line that was triggering the error: > > company = db.auth_user.company) > > should have been: > > company = auth.user.company) > > :P > > Glad you caught that, because I sure didn't. /dps > On Monday, June

[web2py] Re: I am trying to change the background image every 5 seconds like this but this doesn't seem to work?

2016-06-13 Thread Emmanuel Dsouza
I was obviously waiting for your reply only. Ok Anthony I got what you said. But how do I get a variable through an ajax call? Ajax only updates a tag id, right? How do I edit this to make it work? in controller: def index(): return locals() in model: def retimage(): from random import