[web2py] Re: adding onFocus event to a field of an sql form

2016-07-12 Thread pbt
@JIM S Yes,both questions are same.I am finding two different methods for this question.So,I asked same question in two different ways. 1)writing input field manually in view with onfocus="myfunction()" and then storing in database. 2)Manipulating something in controller SQLFORM.factory() to add

[web2py] Re: creating an accessible file with public access

2016-07-12 Thread Aydin
I'm using browser to access it. But it returns invalid. It's interesting because I have other files in static folder and they can be accessed such as Web2py.css. I'm starting to think that maybe when I create the file, it does not give it permission to read by default. I will check that later. B

[web2py] Re: creating an accessible file with public access

2016-07-12 Thread Anthony
On Tuesday, July 12, 2016 at 9:17:05 AM UTC-4, Aydin wrote: > > I am creating a file (test.txt) using the following > > myfile = os.path.join(request.folder, 'static', 'test.txt') > f = open(myfile, 'w') > f.write('%s' % x) > > and I like to see it when I do /myapp/static/test.txt,

Re: [web2py] Re: URL based internationalization and pattern router

2016-07-12 Thread Anthony
On Tuesday, July 12, 2016 at 12:14:29 PM UTC-4, Carlos Cesar Caballero wrote: > > Now I have two more questions: > First, see my other response, as you might be able to restructure your web2py controller(s) to enable you to use the parameter-based router and avoid all of this complexity. > C

Re: [web2py] Re: URL based internationalization and pattern router

2016-07-12 Thread Anthony
On Tuesday, July 12, 2016 at 9:46:22 AM UTC-4, Carlos Cesar Caballero wrote: > > Hi Anthony, unfortunately the parameter-based router doesn't suit my > needs, I need (among other things) the ability to map urls in that way: > > www.mysite.com/cuba to www.mysite.com/app/country/index/cuba > www.mys

Re: [web2py] Re: How to display intermediate Data at html page, if function will run till 6-10 hours.

2016-07-12 Thread Anthony
On Tuesday, July 12, 2016 at 11:41:20 AM UTC-4, Massimo Di Pierro wrote: > > forget load in this case. > > > > > > var counter = 0; > var minutes = 2; > var max_calls = 10; > var url = "{{=URL('call')}}"; > var f = function() { > counter = counter + 1; > jQuery.get(url).done(function(dat

Re: [web2py] Re: How to display intermediate Data at html page, if function will run till 6-10 hours.

2016-07-12 Thread Anthony
It is not clear what you are trying to achieve. Can you explain the real world scenario you are trying to implement? What is the exact workflow? Does someone view a single page, and some content on that page needs to update every 30 minutes? Anyway, regarding your current code, as already menti

[web2py] Re: adding onFocus event to a field of an sql form

2016-07-12 Thread Jim S
So, is this question a duplicate of this one? https://groups.google.com/forum/#!topic/web2py/FAQyd_bU9Fc -Jim On Tuesday, July 12, 2016 at 10:26:00 AM UTC-5, pbt wrote: > > I do not want the input field 'location' to be focussed automatically. I > want to execute a myFunction() when input field

Re: [web2py] Re: web2py traceback is not clear to tell the error

2016-07-12 Thread Michele Comitini
To avoid incurring in overhead on every request you could use a script to be called once with web2py.py -R option. Also you could create a function in a model file with little overhead: def create_indexes(): db.executesql('CREATE INDEX...') later you can call it manually from the shell

Re: [web2py] Re: URL based internationalization and pattern router

2016-07-12 Thread Carlos Cesar Caballero Díaz
Hi, thanks to everyone now I am able to write a pattern-based router for my application including basic internationalization by mapping the url data to a variable as Anthony suggests in his initial reply. Now I have two more questions: Can I replace the URL() function for my application withou

Re: [web2py] Re: How to display intermediate Data at html page, if function will run till 6-10 hours.

2016-07-12 Thread Massimo Di Pierro
forget load in this case. var counter = 0; var minutes = 2; var max_calls = 10; var url = "{{=URL('call')}}"; var f = function() { counter = counter + 1; jQuery.get(url).done(function(data) { jQuery('#target').html(data); if(counter

[web2py] Re: adding onFocus event to a field of an sql form

2016-07-12 Thread Ron Chatterjee
You can also use a "custom form" on table list and use this: http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_onfocus As you build the form, just stick the classes there where you the focus to be. On Tuesday, July 12, 2016 at 11:26:00 AM UTC-4, pbt wrote: > > I do not want the input

Re: [web2py] Re: How to display intermediate Data at html page, if function will run till 6-10 hours.

2016-07-12 Thread Massimo Di Pierro
I have deleted your other post. DO NOT EVER POST YOUR ADMIN PASSWORD ONLINE. It gives complete access to your VM. Please change it and email the new one to me and Anthony privately and we will try help. Massimo -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http

[web2py] Re: adding onFocus event to a field of an sql form

2016-07-12 Thread pbt
I do not want the input field 'location' to be focussed automatically. I want to execute a myFunction() when input field 'location' with id = 'autocomplete' is focused . On Tuesday, July 12, 2016 at 8:08:39 PM UTC+5:30, Jim S wrote: > > Here is what I've added to my layout.html so that all my pa

[web2py] Re: Store value in input field in a table

2016-07-12 Thread pbt
How to add id to the field 'location' using jquery in view. Because my js function also requires the field to have id="autocomplete" On Tuesday, July 12, 2016 at 6:04:53 PM UTC+5:30, Massimo Di Pierro wrote: > > form.element(_name='location')['onfocus'] = 'geoLocation()' > > BUT > > You should re

[web2py] Re: Store value in input field in a table

2016-07-12 Thread pbt
I added these lines in my view jQuery(function() { jQuery('[name=location]').focus(geolocate); }); But it is not working. What I am actually trying to do is while filling field 'location',it should give the suggestions automatically fetched from google maps. The suggestions are coming when I

[web2py] Re: adding onFocus event to a field of an sql form

2016-07-12 Thread Jim S
Here is what I've added to my layout.html so that all my pages automatically position the cursor to the first input field available that doesn't have the .filter class applied to it: $(document).ready(function () { $('form:not(.filter) :input:visible:first').focus().sele

Re: [web2py] Re: How to display intermediate Data at html page, if function will run till 6-10 hours.

2016-07-12 Thread Chetan Jain
Admin Password : c954ecbf Best, Chetan Jain On Tue, Jul 12, 2016 at 7:16 PM, Chetan Jain wrote: > URL : https://pqr.pythonanywhere.com/ajax/default/index > > Best, > Chetan Jain > > On Tue, Jul 12, 2016 at 6:07 PM, Massimo Di Pierro < > massimo.dipie...@gmail.com> wrote: > >> It is not clear. W

Re: [web2py] Re: URL based internationalization and pattern router

2016-07-12 Thread Carlos Cesar Caballero Díaz
Hi Anthony, unfortunately the parameter-based router doesn't suit my needs, I need (among other things) the ability to map urls in that way: www.mysite.com/cuba to www.mysite.com/app/country/index/cuba www.mysite.com/cuba/cienfuegos to www.mysite.com/app/state/index/cuba/cienfuegos www.mysite.c

Re: [web2py] Re: URL based internationalization and pattern router

2016-07-12 Thread Carlos Cesar Caballero Díaz
Thanks Ron, is a very good and useful example. Greetings. El 11/07/16 a las 13:12, Ron Chatterjee escribió: Alternatively you can also look at this: http://www.web2pyref.com/example/routespy-url-rewrite-with-pattern-based-system-used-by-web2pyref-snippet-1 On Monday, July 11, 2016 at 12:19:

Re: [web2py] Re: How to display intermediate Data at html page, if function will run till 6-10 hours.

2016-07-12 Thread Chetan Jain
URL : https://pqr.pythonanywhere.com/ajax/default/index Best, Chetan Jain On Tue, Jul 12, 2016 at 6:07 PM, Massimo Di Pierro < massimo.dipie...@gmail.com> wrote: > It is not clear. Where is your app? > > > On Tuesday, 12 July 2016 06:32:29 UTC-5, Chetan Jain wrote: >> >> Hi Anthony, >> >> i've

[web2py] missing files after "pack compiled"

2016-07-12 Thread Ivan
I have packaged (os: windows) a compiled app but some files were not added. For example: "markers-ma...@2x.png" I guess the "@" character is the problem. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.googl

[web2py] creating an accessible file with public access

2016-07-12 Thread Aydin
I am creating a file (test.txt) using the following myfile = os.path.join(request.folder, 'static', 'test.txt') f = open(myfile, 'w') f.write('%s' % x) and I like to see it when I do /myapp/static/test.txt, but I cann't. the file has been created and I can see it in that folder.

Re: [web2py] Re: How to display intermediate Data at html page, if function will run till 6-10 hours.

2016-07-12 Thread Massimo Di Pierro
It is not clear. Where is your app? On Tuesday, 12 July 2016 06:32:29 UTC-5, Chetan Jain wrote: > > Hi Anthony, > > i've created one 24 hours web2py application at pythonanywhere.com, > please let me know when you have 10-15 minutes of time, so that i can > rectify my problem. > Thanks in ad

[web2py] Re: Store value in input field in a table

2016-07-12 Thread Massimo Di Pierro
form.element(_name='location')['onfocus'] = 'geoLocation()' BUT You should really do this in the view: jQuery(function() { jQuery('[name=location]').focus(geoLocation); }); On Tuesday, 12 July 2016 05:15:27 UTC-5, pbt wrote: > > I know how to generate input fields from form. My doubt is I

Re: [web2py] Re: How to display intermediate Data at html page, if function will run till 6-10 hours.

2016-07-12 Thread Chetan Jain
Hi Anthony, i've created one 24 hours web2py application at pythonanywhere.com, please let me know when you have 10-15 minutes of time, so that i can rectify my problem. Thanks in advance. On Tue, Jul 12, 2016 at 7:43 AM, Anthony wrote: > If your view includes an {{=i}} variable, then yo

[web2py] Angularjs calls to web2py rest api

2016-07-12 Thread botasservice
Hello everyone. Can someone explain me how to get data from table using web2py rest api and angularjs? I have function api(): 1. @request.restful() 2. def api(): 3. response.view = 'generic.json' 4. def GET(*args,**vars): 5. patterns = 'auto' 6. parser

[web2py] Re: Store value in input field in a table

2016-07-12 Thread pbt
I know how to generate input fields from form. My doubt is I want to add an event 'onFocus' to that field. How to do that using SQLFORM.factory On Tuesday, July 12, 2016 at 2:49:30 PM UTC+5:30, Mirek Zvolský wrote: > > You need form and its submitting. > You can use Web2py form support, see web2p

[web2py] Re: Store value in input field in a table

2016-07-12 Thread Mirek Zvolský
You need form and its submitting. You can use Web2py form support, see web2py.com/book chapter 7: FORM, or SQLFORM.factory (you have to save yourselves the input value after the form validation from forms.vars into db database) or SQLFORM (this will save the input value automatically) Bo

Re: [web2py] Re: URL based internationalization and pattern router

2016-07-12 Thread Massimo Di Pierro
There is one logical problem with the parameteric router (as opposed to the regex routes) and that is how it handles missing applicaiton/controller/function. If one is missing, it assumes a default value specified by the routes.py configuration. In this process it must make some assumptions abo

[web2py] Store value in input field in a table

2016-07-12 Thread pbt
in models db.define_table('list' Field('name','string'), Field('location','string') ) I want to store the value present in the above input field to 'location' field in table 'list'. -- Resources: - http://web2py.com - ht

[web2py] Re: How to implement token based restful api in web2py

2016-07-12 Thread Massimo Di Pierro
TW. The name is going to change today. DBAPI will be renamed something else. On Monday, 11 July 2016 07:43:13 UTC-5, Marlysson Silva wrote: > > Without to use DBAPI but still it would be possible to build API Rest with > web2py using @restful? > > Managering dal mannualy > > Em segunda-feira, 11

[web2py] adding onFocus event to a field of an sql form

2016-07-12 Thread pbt
In models db.define_table('list', Field('name', 'string'), Field('location', 'string')) In controller def list(): form = SQLFORM.factory( Field('name',label='Name',requires=IS_NOT_EMPTY()), Field('loca