[web2py] Form for Polymodel

2013-02-01 Thread Gian Luca Decurtins
Hi all I'm building an web2py app on GAE which shall be able to manage different sensor types: - integer input - double input - boolean input For each sensor I would like to be able to define a range of good values. For example the water sensor is in a good state when the input is false. The t

[web2py] Controller: same function with and without arguments

2013-01-30 Thread Gian Luca Decurtins
Hi all What do you think about the following code example? Is there a more elegant way to be able to call a function with and without arguments? How can I select the fields which shall be returned? I did try it in the .select(db.location.id, db.location.name) part, but the JSON output always co

[web2py] Re: SQLFORM.grid and classes on GAE

2012-11-30 Thread Gian Luca Decurtins
ttp://web2py.com/books/default/chapter/29/07?search=grid#SQLFORM.grid-and-SQLFORM.smartgrida > few paragraphs in it shows a controller that can handle any table. > > cfh > > On Thursday, November 29, 2012 6:41:40 AM UTC-8, Gian Luca Decurtins wrote: >> >> Hi all

[web2py] SQLFORM.grid and classes on GAE

2012-11-29 Thread Gian Luca Decurtins
Hi all Given the following model (polymodel location -> location_outdoor & location_indoor) on GAE: define_table('location', Field('name', 'string'), Field('active', 'boolean'), polymodel = True) define_table('location_outdoor', db.location, Field('country', 'string'), F

[web2py] Row level access on GAE datastore

2012-11-25 Thread Gian Luca Decurtins
Hi all How do I enable row level access features on GAE datastore? In the documentation is written that the accessible_query does not work because of the usage of JOIN. Is there an other way of using it? I think it could work using google:sql instead of google:datastore, but I'm trying to avoid

[web2py] Store DB connection information in private/ folder

2012-08-10 Thread Gian Luca Decurtins
Hi all How do I store the DB connection information (db = DAL(...)) in the private/ folder? I would like to sync the application using Mercurial. The local DB information should not be shared. The .hgignore file already includes "private/*". Cheers -Luca. --

[web2py] SQLFORM.grid search using signature

2012-03-19 Thread Gian Luca Decurtins
Hi all I can't perform search operations on SQLFORM.grid forms. If I remove the "@auth.requires_signature()" part, it does work. In the webserver-logfile I noticed that the edit page is signed, while the search page isn't. EDIT: /init/location/form/edit/location/4?_signature=368187847e306b826b

[web2py] Re: CRUD onaccept question

2012-03-09 Thread Gian Luca Decurtins
Thank you Alan! > onaccept=lambda form: locate(request.args(0)) It now works as expected! -Luca.

[web2py] CRUD onaccept question

2012-03-09 Thread Gian Luca Decurtins
Hi all Once again a question related to CRUD: Why is onaccept executed before pressing the "Submit" button? I've written a function "update()" which calls crud.update. After submitting new values I would like to look up the location's latitude and longitude. At the moment I'm facing the problem

[web2py] Re: CRUD .represent question #2

2012-03-08 Thread Gian Luca Decurtins
> > That's not how it works. When the table is defined, if you have > Field('location', db.location, ...) with no explicit "represent=...", then > it will automatically set the "represent" attribute for you based on the > _format attribute of the db.location table. However, if you set an explic

[web2py] Re: CRUD .represent question #2

2012-03-08 Thread Gian Luca Decurtins
> > db.object.location.represent = lambda location, row: \ >>A(location,_href=URL('location', 'update', args=(location.id), >> user_signature=True)) >> > > In the above line, you have specified your own "represent" attribute for > the "location" field, so it will not use the "format"

[web2py] CRUD .represent question #2

2012-03-08 Thread Gian Luca Decurtins
Hi all A crud.select on the object-table does only display the ID of the corresponding location, and not as expected ( '%(id)s: %(country)s, %(city)s, %(street)s, %(name)s' ). What is wrong here? Do I have to restart the webserver if I change the format part of define_table? Cheers -Luca. db.

[web2py] Re: CRUD .represent question

2012-03-07 Thread Gian Luca Decurtins
Hi Yes you're right! But I had to remove the db.location.id.readable = False line. Else it doesn't work. Thank you for helping! -Luca. Am Mittwoch, 7. März 2012 12:18:41 UTC+1 schrieb Alan Etkin: > > row.id should contain the record id, shouldn't it? > > db.location.name.represent = lambda

[web2py] Re: CRUD .represent question

2012-03-07 Thread Gian Luca Decurtins
Hi This is exactly the example from which I started. I've removed the request.args(0) part, because I do not need the generic controller as I already know which table I want to display. I want to change the representation of db.location.name: Display db.location.name, but use db.location.id for

[web2py] CRUD .represent question

2012-03-07 Thread Gian Luca Decurtins
Hi all I would like to use CRUD to display a list of locations. If I press on the location.name it should call the function update() passing location.id as parameter. I've taken the CRUD manage() example from the web2py book [1] and modified it to: @auth.requires_signature() def select():

Re: [web2py] web2py CRUD example

2012-01-27 Thread Gian Luca Decurtins
Thank you! I had to edit models/db.py: # response.generic_patterns = ['*'] if request.is_local else [] response.generic_patterns = ['*'] Regards -Gian. BTW: In the original post I've replaced the FQDN with localhost. If the application did run on localhost this modification should not be necess

[web2py] web2py CRUD example

2012-01-27 Thread Gian Luca Decurtins
Hi all I'm trying to use the CRUD-feature of web2py (1.99.4). At the moment I'm stuck at "invalid view (default/data.html)" while accessing https://localhost/init/default/data/tables. So far I've created a simple application "init" and changed the following: In controllers/default.py I've disab