[web2py] what is loader.js for?

2014-05-26 Thread chuan137
looking at my simple example from chrome developer's tool, I noticed loader.js doing something in the background. seems related with statistics or ads. can someone explain it to me? is it possible to disable it, because I want to do some performance measurements? thanks :) -- Resources: - htt

[web2py] how to modify form input before validation and insert into database?

2014-05-26 Thread chuan137
I want to replace white spaces with underscore and capitialize each word before insert them into database. I am using SQLFORM(...) and I find onvalidation is used after validation. but I want to use this field as a unique keyword, which used in query conditions. what I want is to use a function

[web2py] Re: what is loader.js for?

2014-05-27 Thread chuan137
anyone kowns what it is? On Monday, May 26, 2014 2:08:24 PM UTC+2, chuan137 wrote: > > looking at my simple example from chrome developer's tool, I noticed > loader.js doing something in the background. > seems related with statistics or ads. > > can someone explain it t

Re: [web2py] how to modify form input before validation and insert into database?

2014-05-27 Thread chuan137
Thank you. On Tuesday, May 27, 2014 9:14:07 AM UTC+2, Johann Spies wrote: > > On 26 May 2014 23:26, chuan137 > wrote: > > I want to replace white spaces with underscore and capitialize each word >> before insert them into database. I am using SQLFORM(...) and I find &g

[web2py] Re: how to modify form input before validation and insert into database?

2014-06-02 Thread chuan137
create a > custom validator for the relevant field(s). No need to use SQLFORM.factory. > > Anthony > > On Monday, May 26, 2014 5:26:15 PM UTC-4, chuan137 wrote: >> >> I want to replace white spaces with underscore and capitialize each word >> before insert them int

[web2py] better way to find the updated or inserted record id

2014-06-03 Thread chuan137
Before I insert a record, I need to check whether the record is already in database. If true, then I need to know the id of the record. Below is my implementation, I first does the query, and check whether record exist or not query = db(db.groups.name == 'some_name').select() if query.records:

[web2py] what about the old web2py blog?

2014-06-06 Thread chuan137
It is quite helpful for me, I read it and like the way it explains things. But why is it called 'old'? The techniques are no longer ideal or it just stop updating? I wish there is such a new web2py blog. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.

[web2py] import module once for all

2014-06-13 Thread chuan137
Dear web2pyers, Some functions are packed into a class, which I put it under modules/myclass.py. To reuse the functions, say in the controllers, I usually import the module, create a new instance of myclass inside the controller function. I wonder is it possible to import the module when the

[web2py] Re: Brainstorming

2014-06-19 Thread chuan137
Noelse mentioned Backbonejs yet? working on a project with it now, but do not care for it too much, I am thinking of switching to AngularJS actually. On Sunday, June 15, 2014 10:34:25 AM UTC+2, Massimo Di Pierro wrote: > > Often Angular comes up on this list. I tried it and I was un-impressed. >

[web2py] send json variable as parameters to RESTful api

2014-06-19 Thread chuan137
Dear all, In my javascript code, I would like to have sth like this, $.getJSON(url_to_REST_api, { group: 0, sensors: sensorIDs }, function(res) { timestamp = res['timestamp']; data = res['data']; }); However, sensorIDs is a rather l

[web2py] how to use require js with web2py?

2014-06-24 Thread chuan137
how to load in web2py like in web2py_ajax.html I have response.files.insert(0,URL('static','js/libs/require.js')) then below > require.config({ > paths: { > 'text': "{{=URL('static', 'js/libs/require/text')}}", > 'modules': "{{=URL('static', 'js/modules')}}", >

[web2py] Re: how to use require js with web2py?

2014-06-25 Thread chuan137
27;)}}", > 'templates': '{{=URL('static', 'templates')}}', > 'canvas': "{{=URL('static', 'js/canvas')}}", > } > }); require(['text!templates/hello.html&#x

[web2py] How to deploy web2py under existing host

2014-07-16 Thread chuan137
Hi All, I have to install web2py as part existing VirtualHost. It is serving a few directories, and web2py folder is one of them. this is my settings under WSGIScriptAlias /newstatus /srv/www/hostRoot/web2py/wsgihandler.py AllowOverride None Order Allow,Deny

[web2py] Re: How to deploy web2py under existing host

2014-07-20 Thread chuan137
bump On Wednesday, July 16, 2014 11:03:58 AM UTC+2, chuan137 wrote: > > Hi All, > > I have to install web2py as part existing VirtualHost. It is serving a few > directories, and web2py folder is one of them. > > this is my settings under > > >WSGIScriptAlia

[web2py] simplify parse_as_rest pattern?

2014-07-21 Thread chuan137
Example of parse_as_rest function, there define tables db.define_table('person',Field('name'),Field('info')) db.define_table('pet',Field('ownedby',db.person),Field('name'),Field('info' )) which are served with the pattern "/{person.name}/pets[pet.ownedby]/{pet.name}". That means a valid URL i

[web2py] Re: simplify parse_as_rest pattern?

2014-07-23 Thread chuan137
gt; On Monday, 21 July 2014 16:02:57 UTC-5, chuan137 wrote: >> >> Example of parse_as_rest function, there define tables >> >> db.define_table('person',Field('name'),Field('info')) >> db.define_table('pet',Field(&

[web2py] Re: simplify parse_as_rest pattern?

2014-07-24 Thread chuan137
July 2014 07:43:08 UTC-5, chuan137 wrote: >> >> Maybe you want to expand the functionality for parse_as_rest(), since >> from the menu, there reads "experimental feature". I would be interesting >> to get involved in the discussions. >> >> >>

[web2py] load data for front end

2014-07-24 Thread chuan137
Hi All, For quick and dirty develop, is it a good idea to do var t=<%=XML(response.json(rows))%> in template page? Dear Massimo, can you share how do you use Ractivejs usually? For big project, I would divide front end codes from server end. But how about for simple page, where I only nee

[web2py] how to trailing a slash in url automatically

2014-08-11 Thread chuan137
e.g., from http://localhost/display ===>>> to http://localhost/display/ I tried edit router.py in the root folder, like routes_in=( ('/display4', '/display4/') ) not working, I guess, because '/display4/' is then further routed. Thanks in advance Chuan P.S. background about why I ask. It

[web2py] Re: how to trailing a slash in url automatically

2014-08-11 Thread chuan137
gt; > On Monday, 11 August 2014 04:22:34 UTC-5, chuan137 wrote: >> >> e.g., >> >> from http://localhost/display ===>>> to http://localhost/display/ >> >> I tried edit router.py in the root folder, like >> >> routes_in=( >> ('/d