On Thu, Feb 16, 2012 at 10:32 PM, <[email protected]> wrote:

>  > I am using save() method.
> > The matter is that, before calling save(), I must call new()  +
> > setFieldVal() on appended record(s) ;
> > For updated records, seek() + setFieldVal().
>
>        I still don't understand why this is a problem for you. Are you
> simply trying to write your application using the fewest lines of code
> possible? To me, it looks like you are doing the bare minimum necessary:
> determining the record, whether it exists or newly created, and then making
> your changes.
>
>

Yes. As you say, the hook methods should be utilized to make full use of
the framework.
At present, I have built client-side data-validation through javascript (in
web2py framework).
Using dabo validation would add another tier of validation. Good idea.


       Keep in mind that doing something as simple as calling bizobj.new()
> does a lot more than simply append a blank record to the local cursor.
> There are hook methods that fire before and after the record is appended,
> allowing you to do things like check security settings to make sure that
> the user is authorized to perform that action, or populate the PK of the
> new record, or set default values for any number of columns in the new
> record automatically. You may not need any of these for your current usage,
> but remember that this is an application framework, and as such it needs to
> be able to handle a wide range of use cases.
>
> > If I were using UI layer, I think this can be taken care of by dabo
> > automatically (pl. correct me if I am wrong).
> > Since I am using just biz & db layers, I need to identify the appended
> > records & updated records myself.
> > Then call save() on parent bizobj.
>
>        You'd probably want to call saveAll(), rather than call save() once
> for each record.
>
>        Keep in mind that save() doesn't just blindly write your data,
> either. It includes data validation hooks, pre- and post-processing of the
> data, error handling, etc. This is why each part of the process is
> separated out: different developers will need to customize different parts
> for the particular application that they are developing.
>
>        If you really absolutely have to do all this in a single line, you
> can:
>
> New record:
> bizobj.safeExecute("insert into mytable values ('foo', 'bar', 99)")
>
> Updated record:
> bizobj.safeExecute("update mytable set col1='foo', col2='bar' where id=42")
>
>        Of course, you are completely bypassing the framework hooks and
> interacting with the database directly, so no validation or error-handling
> is available.
>
>

> -- Ed Leafe
>


No. I wouldn't like to bypass the hooks.
Let me see how I can make use of most of the methods in dabo.

Thanks,

Vineet


--- StripMime Report -- processed MIME parts ---
multipart/alternative
  text/plain (text body -- kept)
  text/html
---
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: 
http://leafe.com/archives/byMID/CAP5=7oqZ0EPn6obg-SOXS49ZncdiARZ5YZ=xupfsftqhvmh...@mail.gmail.com

Reply via email to