I am sorry, today I have found that this was my mistake.
I have string values from SQLFORM - and compute evaluates properly.
But I have different FORM for bulk insert of many records, where
in form.process().accepted I have integer values:
compute in DAL is wrapper into try/except - and it
Please show your code.
On Friday, December 19, 2014 6:13:02 AM UTC-5, Mirek Zvolský wrote:
Web2py book says
When a new record is modified, including both insertions and updates,
if a value for the field is not provided, web2py tries to compute
For me this works well after UPDATE from
I've deleted the testing db and started with a new one and now it works for
me too. I've tried add a new record to problemsHere but it gave me an
unexpected error (the DAL expected an unique field in language and
language is no longer an unique field), so probably the issue was
somewhere else.
I can't replicate the issue you're having. That syntax works. Check again
your code
BTW: it's quite a strange model. you want the language to be unique in the
first table. In the second one you reference the first table (that is
unique by definition) with a non unique reference, but then
I like to store the difference as integer not char(512)
I guess the output of the compute function is a timedelta object (since you
are operating with date objects), which has a .days attribute. You can use
the .days attribute instead:
compute=lambda r: (r['end_date']-r['begin_date']).days
Thanks a lot!
2013. május 19., vasárnap 17:20:45 UTC+2 időpontban Alan Etkin a következőt
írta:
I like to store the difference as integer not char(512)
I guess the output of the compute function is a timedelta object (since
you are operating with date objects), which has a .days
Hallo Daniel,I have defined a database table which has some fields which
must be computed:
Field('password', 'password', length=512,
compute=automatic_password,readable
=False, label='Password'),
The functions create_new_agent and automatic_password are part of my
libraries. They
On Wednesday, 22 August 2012 15:28:50 UTC+2, Johann Spies wrote:
Hallo Daniel,I have defined a database table which has some fields which
must be computed:
Field('password', 'password', length=512,
compute=automatic_password,readable
=False, label='Password'),
The functions
Field('password', 'password', length=512,
compute=automatic_password,readable
=False, label='Password'),
The functions create_new_agent and automatic_password are part of my
libraries. They are returning the expected types (strings in both cases)
If you search the book for
Thanks guys,
After all your comments I have found the problem: my agent database was
defined *twice* in my models, one time with computed fields, the final time
without them. I was getting very strange behavior and was quite confused -
understandably.
I have removed the phoney definition,
And now a small explanation of why I did not notice this at first:
I had a define_table in a testing.py controller. I have removed this
controller from my development repo, but since I am rsyncing to the web2py
applications directory, that old testing.py controller was still in the
e ... i meant testing.py *model*
On Wednesday, August 22, 2012 6:53:52 PM UTC+2, Anthony wrote:
And now a small explanation of why I did not notice this at first:
I had a define_table in a testing.py controller. I have removed this
controller from my development repo, but since I am
Thank you both for your replies. I'll give your solutions a try and see
which one best suits my needs.
Kind regards,
Annet
I'd probably use a function or virtual field for that, not store it in DB.
And it could be cleaned up a bit. Something like:
def trunc_desc(s)
if len(s) 128:
return s[:128] + '...'
return s
Dont workedthe field dont show in form
Sorry...any ideas ??
On 21 Dez, 22:05, Jose Carlos Junior josec...@gmail.com wrote:
Thank you Jim .i gonna try this as soon as possibleand
return...
On 21 dez, 18:21, Jim Steil j...@qlf.com wrote:
Here's what I would try:
Sorry it worked.i made a mistake
Thank you Jim
On 22 Dez, 09:46, Jose Carlos Junior josec...@gmail.com wrote:
Dont workedthe field dont show in form
Sorry...any ideas ??
On 21 Dez, 22:05, Jose Carlos Junior josec...@gmail.com wrote:
Thank you Jim .i gonna
thanks for the update, good to hear you got it working.
-Jim
On 12/22/2011 6:13 AM, Jose Carlos Junior wrote:
Sorry it worked.i made a mistake
Thank you Jim
On 22 Dez, 09:46, Jose Carlos Juniorjosec...@gmail.com wrote:
Dont workedthe field dont show in form
Thank you Jim .i gonna try this as soon as possibleand
return...
On 21 dez, 18:21, Jim Steil j...@qlf.com wrote:
Here's what I would try:
Field('difference', compute=lambda u: (u['DT_FECHAMENTO '] -
u['DT_ABERTURA ']), label='Difference')
This is untested. I haven't used compute
Solved..Thanks alot... dear Richard Vézina
On 19 dez, 21:42, Jose Carlos Junior josec...@gmail.com wrote:
Good idea...
I gonna try thisas soon as possible
Thanks alot...
On 19 dez, 17:44, Richard Vézina ml.richard.vez...@gmail.com wrote:
Carlos,
If you really not
Your welcome :)
Richard
On Tue, Dec 20, 2011 at 1:15 PM, Jose Carlos Junior josec...@gmail.comwrote:
Solved..Thanks alot... dear Richard Vézina
On 19 dez, 21:42, Jose Carlos Junior josec...@gmail.com wrote:
Good idea...
I gonna try thisas soon as possible
Thanks alot...
OK
but i need to call from gtils_representante table the nm_cidadao from
cidadao tablethis is my doubt
gtils_representante is a n:n relationship between GTIL(not posted) and
representante.
I believe I have not explained it right the first time...
What about that :
db.tab2(db.tab1(id).id).field
??
Richard
On Mon, Dec 19, 2011 at 11:42 AM, Jose Carlos Junior josec...@gmail.comwrote:
OK
but i need to call from gtils_representante table the nm_cidadao from
cidadao tablethis is my doubt
gtils_representante is a n:n
Carlos,
If you really not getting it... Here what I am doing to work around the
kind of problem you seem to have...
I would make a view at backend level with id and reprensent I want for this
particular id, then I write db model for the view like if it was a web2py
table and then use this table
Good idea...
I gonna try thisas soon as possible
Thanks alot...
On 19 dez, 17:44, Richard Vézina ml.richard.vez...@gmail.com wrote:
Carlos,
If you really not getting it... Here what I am doing to work around the
kind of problem you seem to have...
I would make a view at backend
I'd be curious as well. That looks like my resize_image function. For now
I've just been letting old images clutter up. Somehow you'd need to know
the original filename to be able to delete it either in the resize_image
function or perhaps a second computed function.
25 matches
Mail list logo