Missing the old document for DAL

165 views
Skip to first unread message

Iceberg

unread,
May 3, 2009, 6:59:40 AM5/3/09
to web2py Web Framework
Hi Massimo,

Once again, I forgot the syntax for the limitby clause, so I turned to
the built-in doc for help. Unfortunately, the detail syntax of limitby
is not mentioned at all.
http://www.web2py.com/examples/default/dal

Eventually google still guides me to the old document for DAL:
http://svn.assembla.com/svn/180Project/src/web2py/applications/examples/views/default/orm.html

IMHO, that old DAL document still serves good for beginners, because
it has more details than the current new DAL document. Shall we merge
it back into the current DAL doc?

mdipierro

unread,
May 3, 2009, 10:45:35 AM5/3/09
to web2py Web Framework
why not. Can you do it and send me a new file?

Massimo

On May 3, 5:59 am, Iceberg <iceb...@21cn.com> wrote:
> Hi Massimo,
>
> Once again, I forgot the syntax for the limitby clause, so I turned to
> the built-in doc for help. Unfortunately, the detail syntax of limitby
> is not mentioned at all.
>  http://www.web2py.com/examples/default/dal
>
> Eventually google still guides me to the old document for DAL:
>  http://svn.assembla.com/svn/180Project/src/web2py/applications/exampl...

Yarko Tymciurak

unread,
May 3, 2009, 2:53:37 PM5/3/09
to web...@googlegroups.com
There are examples throughout the code - look at sql.py and gql.py for examples in the docstrings (I agree, the docstrings could explain a little more).

select(limitby=(start_record,end_record), so limitby(1,2) would select one record - record 1 (2 is not included).
You can see this in test_dal.py test cases.

The book (page 147) uses an example which does not clear up use:

"With limitby you can select a subset of records, in this case the first two starting at zero:

.....select(...., limitby(0,2))

This leaves the use ambiguous:  is 2 the number of records to return, or the ending record number? You can't tell from this; you still have to either experiment, or look at the test cases.

Yarko Tymciurak

unread,
May 3, 2009, 4:20:51 PM5/3/09
to web...@googlegroups.com
On Sun, May 3, 2009 at 1:53 PM, Yarko Tymciurak <yar...@gmail.com> wrote:
There are examples throughout the code - look at sql.py and gql.py for examples in the docstrings (I agree, the docstrings could explain a little more).

select(limitby=(start_record,end_record), so limitby(1,2) would select one record - record 1 (2 is not included).
You can see this in test_dal.py test cases.

The book (page 147) uses an example which does not clear up use:

"With limitby you can select a subset of records, in this case the first two starting at zero:

.....select(...., limitby(0,2))

This leaves the use ambiguous:  is 2 the number of records to return, or the ending record number? You can't tell from this; you still have to either experiment, or look at the test cases.

BTW - thanks for your question;  I never spotted this ambiguity before! ;-)

Iceberg

unread,
May 4, 2009, 11:47:03 AM5/4/09
to web2py Web Framework
Hi Massimo, how about the attached new dal.html? It is a merged version of orm.html and current dal.html.

BTW, just noticed you use:
def dal(): return response.render(dict())
in the controller. Why not just use:
def dal(): return {}
But anyway, not a big deal. :-)

Best regards,
Iceberg, 2009-May-04, 23:39(PM), Mon

----------------------- Original Message -----------------------
From: mdipierro <mdipie...@cs.depaul.edu>
To: web2py Web Framework <web...@googlegroups.com>
Date: Sun, 3 May 2009 07:45:35 -0700 (PDT)
Subject: Re: Missing the old document for DAL
-------------------

> why not. Can you do it and send me a new file?
>
> Massimo
>
> On May 3, 5:59 am, Iceberg <iceb...@21cn.com> wrote:
> > Hi Massimo,
> >
> > Once again, I forgot the syntax for the limitby clause, so I turned to
> > the built-in doc for help. Unfortunately, the detail syntax of limitby
> > is not mentioned at all.
> >  http://www.web2py.com/examples/default/dal
> >
> > Eventually google still guides me to the old document for DAL:
> >  http://svn.assembla.com/svn/180Project/src/web2py/applications/exampl..
> >

dal.html

mdipierro

unread,
May 4, 2009, 11:54:32 AM5/4/09
to web2py Web Framework
thanks for the document.

because the former allows me to cache both action and view.
>  dal.html
> 18KViewDownload

Iceberg

unread,
May 4, 2009, 12:14:30 PM5/4/09
to web2py Web Framework
I guess you mean that, you once planned to use cache feature, but did
not. Currently there is no @cache.ram(...) or something inside the
controller. Again, not a big deal. :-P
Reply all
Reply to author
Forward
0 new messages