[web2py:12419] Unable to determine what to delete

2008-11-23 Thread Tari
Hi, I would really appreciate help with this one: db((db.table1.data == data) & (db.table2.table1_id == db.table1.id)).delete() This condition works quite OK in a select, but how can I delete these rows? Instead deleting the appropriate rows from both tables, py gives me an "Unable to determine

[web2py:12530] Field alias

2008-11-26 Thread Tari
I thought I'd go ahead and ask, and stop googling in vain... Is there a way to rename a field in a select, e.g. as in "SELECT SUM(column1) + SUM(column2) AS shortname ..." Thanks. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the G

[web2py:12576] Re: Field alias

2008-11-27 Thread Tari
ger'),SQLField('b','integer')) > >>> db.t.insert(a=2,b=3) > 1 > >>> db.t.insert(a=3,b=7) > 2 > >>> shortname=db.t.a.sum()+db.t.b.sum() > >>> rows=db(db.t.id>0).select(shortname) > >>> print rows[0]._extra[

[web2py:12593] Re: Field alias

2008-11-28 Thread Tari
I'm using 1.50, and tried the EXACT same code you provided as an example... On Nov 28, 2:31 am, mdipierro <[EMAIL PROTECTED]> wrote: > which version do you have? Could you show me the exact code you are > using? > > On Nov 27, 6:17 pm, Tari <[EMAIL PROTECTED]> wro

[web2py:12611] Re: Field alias

2008-11-28 Thread Tari
8, 3:34 pm, mdipierro <[EMAIL PROTECTED]> wrote: > This is because of a bug fixed in 1.51. Replace > > print rows[0]._extra[shortname] > > with > > print rows[0]._extra[str(shortname)] > > and it should work. > > Massimo > > On Nov 28, 8:15 am, Tari <[EM

[web2py:13089] Call a conroller function to render HTML in a view

2008-12-07 Thread Tari
Hello, I'm still learning web2py, and have hit a wall once more: I'd like to know if it is possible to call a function from a view, one that would e.g. output a number of LI() helpers in a loop, and also append a text string to the HTML. I tried calling "response.write" from within a controller

[web2py:13625] Extract date part from a datetime

2008-12-16 Thread Tari
Hello again, Just a quick one: Is there a way I could retrieve only the date part in a db operation? Looking for a substitute for this: dt = datetime.datetime.today() db((db.table.posted.day() == dt.day) & (db.table.posted.month() == dt.month) & (db.table.posted.year() == dt.year) .select(...

[web2py:13945] Import lazyT in a module

2008-12-20 Thread Tari
Hello, I'm using a separate py module (in the modules folder) for some of my code. I understand that gluon objects must be explicitly imported, since they are not globally visible as with controllers and models. I had no problem with that except for the T(). Here's a sample code: from gluon.htm

[web2py:15067] Translate text with link(s)

2009-01-17 Thread Tari
Hello again, As I dive deeper and deeper into the (exciting) world of web2py, I come to face increasingly tough challenges. I've searched and read the discussions back and forth, yet could not find an acceptable solution for my T() problem. Suppose you have to translate this entire expression, t

[web2py:15088] Re: Translate text with link(s)

2009-01-18 Thread Tari
t; cases you should use a prefix and a dictonary for your base language, > too (since we don't have domains like gettext). > > On Jan 18, 7:50 am, mdipierro wrote: > > > I can think of other solutions but the one you propose seems the > > simplest one. > >

[web2py:15130] SQLFORM and XHTML 1.0 Strict

2009-01-19 Thread Tari
Hello, While going through my project output pages and validating them as "XHTML 1.0 Strict" I've learnt that SQLFORM creates a form with a table containing the DB labels and DB form elements, which is XHTML compliant up to that point. What fails the validation are the "_formkey" and "_formname"

[web2py:15133] Re: SQLFORM and XHTML 1.0 Strict

2009-01-19 Thread Tari
e not, though :) On Jan 20, 4:23 am, mdipierro wrote: > Can you cut and paste an example of how the output should be? > > Thank you for pointing this out. > > Massimo > > On Jan 19, 9:06 pm, Tari wrote: > > > Hello, > > > While going through my project ou

[web2py:15143] Re: SQLFORM and XHTML 1.0 Strict

2009-01-20 Thread Tari
Oh, by the way, the TBODY which appears in what I've pasted was generated by Firefox. Needless to say - it is by no means compulsory. That at least should not give us a headache. Alternatively, the "_action" can be inserted by hand, so that's not so big a deal either. The two input elements, howe

[web2py:15144] Re: SQLFORM and XHTML 1.0 Strict

2009-01-20 Thread Tari
Oh, by the way, the TBODY which appears in what I've pasted was generated by Firefox. Needless to say - it is by no means compulsory. That at least should not give us a headache. Alternatively, the "_action" can be inserted by hand, so that's not so big a deal either. The two input elements, howe