[web2py] Re: automatically count field edits

2014-01-18 Thread Jaime Sempere
> I'm trying to automatically count each time a record is being updated. I > could make a lambda function that worked for a dictionary: > Field('edits', 'integer', compute=lambda r: int(r['edits'] or 0) + 1 ), > > However, I don't get this to work in practice. Can a lambda for edits not > use i

[web2py] Re: call a function inside the same view

2014-01-18 Thread Jaime Sempere
I think you are mixing concepts you cannot return something from process().accepted, you need to return at the end of your "tracer_form()" function, is the function who returns things. In the proccess().accepted you can do some operations, and modify variables that will be later returned b

[web2py] Re: Update table data on form submission

2014-01-18 Thread Jaime Sempere
> > > I have tried this and work, let me know if it's the think you wanted. I have used SQLFORM but i guess the code will be the same for CRUD (I have never used it) Just my workaround, I think there will be a better method perhaps import time # This is required to include time module. impo

Re: [web2py] Re: simplest way to get rid of "None" strings

2014-01-18 Thread Anthony
> > but I mean the field is empty / Null / None (type), > which is translated by web2py into a string value 'None'. > None is translated into a string value as 'None' by Python, not web2py. If you want different behavior, you have to be explicit (no reason to assume the default behavior should

[web2py] automatically count field edits

2014-01-18 Thread Robin Manoli
I'm trying to automatically count each time a record is being updated. I could make a lambda function that worked for a dictionary: Field('edits', 'integer', compute=lambda r: int(r['edits'] or 0) + 1 ), However, I don't get this to work in practice. Can a lambda for edits not use its own value?

[web2py] Re: Important New Year News: Edison Award

2014-01-18 Thread Matheus Cardoso
You deserve it, Massimo. I wish the best for you and to the awesome web2py! On Saturday, January 4, 2014 1:08:38 AM UTC-3, Massimo Di Pierro wrote: > > Web2py/me have been nominated for the Edison Award. Please wish web2py > (and me) good luck. :-) > > -- Resources: - http://web2py.com - http:/

[web2py] Running google visualization js in a LOAD component

2014-01-18 Thread Jordan Ladora
Example from https://google-developers.appspot.com/chart/interactive/docs/gallery/combochart If I place this code in a standard .html view, it works fine- jQuery(document).ready(function() { setTimeout(function() { // Google Visualization stuff goes here function drawVisualization()

[web2py] How can I use a view in combination with a service ?

2014-01-18 Thread Stef Mientki
hello, maybe I'm doing this completely wrong, but it's a long time ago I used web2py. In the main page I have a lot of links. In fact these links are just indexes to a row in the database. As I understand, the only way to pass parameters from clicking a link, is to use services. An example

[web2py] How to update the whole column after new insert

2014-01-18 Thread Jaime Sempere
Hi everyone, Although I have used database serveral times, I have not done anything beyond very basic, so I am wondering what would be the best practice for this case: I have a database table for storing a 'real-time' playlist of songs like this: db.define_table('playlist',Field('title','st

[web2py] Re: custom one-to-many left-join python object and json object

2014-01-18 Thread Alan Etkin
> > Hey, > I have a simple one-to-many relation, between questions and answers. Each > question may have 0 or more answers, so any *db.answer.question* refers > to a certain *db.question.id *. > > Now, in order to create a code for efficiently displaying the questions > a

[web2py] Re: SQLFORM with Auth UserID

2014-01-18 Thread Massimo Di Pierro
My bad. I put the typo in the example. On Saturday, 18 January 2014 12:51:30 UTC-6, David wrote: > > I see my problem was a simple syntax error. > > == not = > > Yes it is working like that. Thank you Massimo! > > On Saturday, January 18, 2014 12:50:07 PM UTC-6, David wrote: >> >> Hi Massimo, >>

[web2py] Update table data on form submission

2014-01-18 Thread Jochen Schoenfeld
Hi! I have a problem with web2py ... I want to timestamp user-initiated changes in tables which perfectly works when using Field('modified_on', 'datetime', default=request.now, update=request.now, readable=False, writable=False), But since my application also changes values in

Re: [web2py] Re: simplest way to get rid of "None" strings

2014-01-18 Thread Stef Mientki
thanks, it's a workaround, but I mean the field is empty / Null / None (type), which is translated by web2py into a string value 'None'. cheers, Stef On 18-01-14 19:06, Niphlod wrote: if you mean the "other" app fills the fields with an actual string that holds the 'None' value (it could be v

Re: [web2py] Re: DAL usage

2014-01-18 Thread Anthony
Also, note that models_to_run is a list of regexes (relative to the /models folder), so you don't need to list each individual model file. Anthony On Saturday, January 18, 2014 2:08:16 PM UTC-5, Anthony wrote: > > Only the default value of models_to_run assumes a 1:1 correspondence > between co

Re: [web2py] Re: DAL usage

2014-01-18 Thread Anthony
Only the default value of models_to_run assumes a 1:1 correspondence between controllers and models. You can set the value of models_to_run to whatever you want conditionally (and it can even change multiple times from model file to model file). So, for example, you could do: if request.control

[web2py] Re: Css cache problem

2014-01-18 Thread LightDot
Hi and welcome! If you look at the source of the page in a browser, do you see the static_version inserted as a part of the path to your css? It should be something like /static/_1.1.4/css/somecssfile.css. After a change to 1.1.5, the path should change to /static/_1.1.5/css/somecssfile.css.

[web2py] Re: SQLFORM with Auth UserID

2014-01-18 Thread David
I see my problem was a simple syntax error. == not = Yes it is working like that. Thank you Massimo! On Saturday, January 18, 2014 12:50:07 PM UTC-6, David wrote: > > Hi Massimo, > > This is where I was having problems. I tried what you posted. > > @auth.requires_login() > def edit_rigs(): >

[web2py] Re: SQLFORM with Auth UserID

2014-01-18 Thread David
Hi Massimo, This is where I was having problems. I tried what you posted. @auth.requires_login() def edit_rigs(): form = SQLFORM.grid(db.rig.user_id = auth.user.id, user_signature=False) return dict(form=form) I get a "Keyword can't be expression error" on this. That's where I am g

[web2py] Re: Important New Year News: Edison Award

2014-01-18 Thread Greg Vaughan
Congratulations... and a big thank you also... I have just found web2py and absolutely amazed at how brilliant it is On Saturday, 4 January 2014 14:08:38 UTC+10, Massimo Di Pierro wrote: > > Web2py/me have been nominated for the Edison Award. Please wish web2py > (and me) good luck. :-) > > --

[web2py] Css cache problem

2014-01-18 Thread Sébastien Loix
Hi, I'm new to web2py and just learning the framework. I have an issue with my CSS static file which is not reloaded by the browser in local. I have read thread about versioning of static files but it doesn't seem to solve the problem. Probably I don't it correctly. Here is the line set in my d

[web2py] Re: SQLFORM with Auth UserID

2014-01-18 Thread Massimo Di Pierro
replace form = SQLFORM.grid(db.rig, user_signature=False) with form = SQLFORM.grid(db.rig.user_id = auth.user.id, user_signature=False) On Saturday, 18 January 2014 10:42:38 UTC-6, David wrote: > > Hey guys, > > It's been a while since I used web2py and I've pretty much forgotten

[web2py] Re: Can not run web2py_no_console.exe. Version 2.8.2 on win 7 x 64

2014-01-18 Thread Niphlod
we're trying to come up with something here http://code.google.com/p/web2py/issues/detail?id=1809 if you have any inputs please share ^_^ On Saturday, January 18, 2014 1:30:33 AM UTC+1, Ray (a.k.a. Iceberg) wrote: > > > > On Sunday, December 15, 2013 10:00:19 AM UTC-7, Rob Paire wrote: >> >> Hel

[web2py] Re: simplest way to get rid of "None" strings

2014-01-18 Thread Niphlod
if you mean the "other" app fills the fields with an actual string that holds the 'None' value (it could be very well "foo", "bar" or "pizza") then fake_none_value = 'foo' for f in db.table.fields: db(db.table[f] == fake_none_value).update(f=None) should solve it On Saturday, January 1

[web2py] SQLFORM with Auth UserID

2014-01-18 Thread David
Hey guys, It's been a while since I used web2py and I've pretty much forgotten everything. Try as I might for the last two days I can't quite figure this out. I used a web2pyslice to create a main application which manages authentication. I have another app referencing main to login/logout

[web2py] simplest way to get rid of "None" strings

2014-01-18 Thread Stef Mientki
hello, my database (sqlite) is (partially) filled by another program, which inserts Null or None values. Now if I use these fields in an HTML form, they show up as "None" instead of an empty string. Is there a simple way to solve this for all fields at once ? thanks, Stef -- Resources: - htt

Re: [web2py] Re: DAL usage

2014-01-18 Thread Arnon Marcus
Thanks anthony, you're right - this models_to_run approach makes no sense in my use-case - it assumes a 1:1 correlation between controllers and their used-models, which would only occure in very simple apps. The whole point of using a relational database is to have great flexibility and diversit

Re: [web2py] DAL read and variables

2014-01-18 Thread DAL read and variables
First, thank you very much for your help. The first solution works perfect :) But i have some issues with the ongoing ones, i'm afraid def ausgabe(): a = 4 records = SQLTABLE(dba(dba.person._id== a).select(dba.person.name),headers='fieldname:capitalize') newvariable = records[0].name