web2py 1.56 is OUT

Markus Gritsch m.gritsch at gmail.com
Fri Feb 6 02:28:52 EST 2009


Hi,

when copying and pasting the example from the announcement into files,
it wont run due to some errors:

2009/2/5 Massimo Di Pierro <MDiPierro at cs.depaul.edu>:
>
> Example of code (complete app)
> =========================
>    ## in model db.py
>    from gluon.tools import *
>    db=SQLDB()
>    db.define_table('puppy', db.Field('name'), db.Field('image','upload'))
>    auth=Auth(globals(),db)

Here the line auth.define_tables() is missing.

>    crud=Crud(flobals(),db)

flobals -> globals

>    ## in controller default.py
>    def user():
>        " to expose register, login, logout, etc "
>        return dict(form=auth())
>
>    @auth.requires_login()
>    def data():
>         " to expose select, create, update, delete, etc "

The above line is indented one character too much which results in an error.

>        return dict(form=crud())
>
>    @auth.requires_login()
>    def download():
>        " for downloading uploaded images "
>        return response.download(request,db)
>
>    ## in view default/user.html
>    {{extend 'layout.html'}}
>    <div>{{=form}}</div>
>
>    ## in view default/data.html
>    {{extend 'layout.html'}}
>    <div>{{=form}}</div>

The above example is not (although stated) a complete app, even when
correcting the errors.  No index action, no links to register, login,
etc, no functionality in the data action.  If one has not already read
the web2py auth docu, one cannot understand what should be going on.

If I would have been looking at web2py for the first time, I would
have been disapointed and would not bother looking deeper.  Also the
glued-together code style without spaces after colons and around
operators looks quite special.  When suggesting PEP 8 compliance I
suggested using it in the *examples*, and just optionally in the gluon
code itself.  The example and the documentation is the stuff people
are seeing and reading when trying to get started with web2py.

I know, the above paragraphs sound quite negative.  *I* like web2py
very much and am a happy user.  I just fear that such examples will
not draw new users towards this great project.  Maybe use a simple
example without Auth the next time, which is *really* complete and
fully functional.

Kind regards,
Markus



More information about the Python-list mailing list