Many thanks Anthony!
That looks like it will work for now...I may specifically handle call that
code just before validate_and_insert calls in the web app, so I don't get
rid of readURL validation in a place where I need it.
On Friday, April 21, 2017 at 4:46:51 PM UTC-4, Anthony wrote:
>
> Thank
Thanks. I updated the Github issue, as there are multiple problems with the
current implementation of the .validate_and_ methods.
For now, you should be able to get around the two issues you observe by
removing the validators:
db.story.titleAsSlug.requires = db.story.readURL.requires = None
Yo
Can do, here's an example:
# DB
db.define_table('story',
Field('title',
length=512,
widget=lambda field, value: SQLFORM.widgets.string.widget(field,
value,
_size=40),
requires=[IS_NOT_
Need to see the fields.
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py
Thanks for the update!
I'm passing all of the fields needed by the compute function. It looks
something like this:
dct_new_user = { fields here }
# new_user = db.auth_user.insert(**dct_new_user)
new_user = db.auth_user.validate_and_insert(**dct_new_user)
The former calcu
I'm not sure if this is the cause of your problem, but I just posted an
issue: https://github.com/web2py/pydal/issues/462
Anthony
On Thursday, April 20, 2017 at 10:30:14 AM UTC-4, Anthony wrote:
>
> On Wednesday, April 19, 2017 at 7:50:46 PM UTC-4, Chris wrote:
>>
>> Uh oh...I just removed requi
On Wednesday, April 19, 2017 at 7:50:46 PM UTC-4, Chris wrote:
>
> Uh oh...I just removed requires from the computed field and reran my unit
> tests, and now validate_and_insert inserts but the computed field isn't
> calculated at all! I tried insert and it does the computation.
>
> Is there some
Uh oh...I just removed requires from the computed field and reran my unit
tests, and now validate_and_insert inserts but the computed field isn't
calculated at all! I tried insert and it does the computation.
Is there some reason validate_and_insert would not compute where insert
does?
On Wed
I looked it up:
Notice that requires=... is enforced at the level of forms, required=True
> is enforced at the level of the DAL (insert), while notnull, unique and
> ondelete are enforced at the level of the database. While they sometimes
> may seem redundant, it is important to maintain the di
On Tuesday, April 18, 2017 at 5:41:38 PM UTC-4, Chris wrote:
>
> Thanks for the info Anthony! I'll try one of those approaches.
>
> Why is validation run before compute?
>
In terms of implementation, compute is handled in the .insert() method,
which must necessarily run after validation. I suppos
Thanks for the info Anthony! I'll try one of those approaches.
Why is validation run before compute?
On Apr 18, 2017 2:50 PM, "Anthony" wrote:
You should not set "requires" on a computed field -- when you use
validate_and_insert, the validation will be run before the computed value
is generated
You should not set "requires" on a computed field -- when you use
validate_and_insert, the validation will be run before the computed value
is generated. However, you can instead set required=True. In that case, any
time you do an insert or update, if the fields needed by the computed field
are
As per the docs, they say they are stored in db but not computed on
retrieval. i guess this applies to updates.
Does this calculate_field function does not return a value in some case?
for example total = unit * price may be None if the operation fails because
either unit or price is None or th
Hi Alfonso,
I think the original reason was that sometimes I would end up with a
computed field without a value. Inserts should automatically compute rows,
but for some reason that wasn't happening here.
On Apr 18, 2017 8:04 AM, "Alfonso Serra" wrote:
Hi Chris, why do you use requires IS_NOT_EM
Hi Chris, why do you use requires IS_NOT_EMPTY in a computed field?, if you
do, you have to supply a value before is computed, isnt it?
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/is
15 matches
Mail list logo