Hi Massimo,

Some feedback on utils.py from an "occasional" web2py developer.

I found lots to like in Auth compared to the current t2.py, ie:
- increased customization in the Auth API, ie settings.mailer (eg, I
have use a html mail function)
- support for username instead of email as primary user id

In my current app I have copied & pasted (brrrr...) several Auth
functions because it looked unwise to subclass t2 -- there being a
single t2 instance. But in this new setup I should be able to subclass
Auth and redefine only one or two specific methods. Right?

Re Crud, you hint at onvalidation support in the new crud functions --
that would be *really* welcome. In general, I would like to be able to
pass more SQLFORM params to crud functions (eg, fields?) -- more
customization and delegation options help to move T2 crud from a "90%"
solution closer to 98 or 99...

Finally, I don't want to go all java on you, but wouldn't more
explicit APIs help to put some distance between interface and
implementation -- and thus easier to reimplement or modify parts that
need this? My impression is that the current APIs are primarily
function signatures, and that underlying dependencies, side effects
and interfaces to data structures are sometimes left as an exercise
for the reader. ;-)

Web2py is evolving so fast that between the Book, epydocs, Alterego
and the current "complete" API on the website, I find am looking at
web2py source (and running dir() in a shell) much more often than I
probably should. I do realize that the docs have to catch up with
development. Isn't it time to consider a single new (collaborative?)
reference for the evolving web2py APIs? Not just the technical
interface definitions (a la epydocs), but the semantics as well. I'd
be happy to contribute where I can -- within the limitations that come
with my "occasional" status.

Hope this helps,
Cheers,
-Peter

On Jan 21, 10:46 am, mdipierro <mdipie...@cs.depaul.edu> wrote:
> yes but only so that you can test them and provide feedback. I hope to
> finalize the APIs and documentations within the week.
>
> also I would like to change the name of the file from utils.py to
> something more catchy. Any suggestion?
>
> Massimo
>
> On Jan 21, 1:33 am, David Marko <dma...@tiscali.cz> wrote:
>
> > These things look very nice.
> > Does it mean that described changes are available in svn trunk
> > version?
>
> > David
>
> > On 21 Led, 00:36, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > > I have a preliminary version of inclusion if T2 functionality into
> > > web2py core. I am not yet promising backward compatibility here. The
> > > module name many change. For now it is in trunk as gluon/utils.py
>
> > > Here is how you use it (assuming [app] is you application name).
>
> > > 1) put this in your model
>
> > > from gluon.utils import *
> > > auth=Auth(globals(),db)
> > > auth.define_tables()
> > > crud=Crud(globals(),db)
>
> > > 2) put this in your "default" controller
>
> > > def user(): return dict(form=auth())
> > > def database(): return dict(form=crud())
> > > def download(): return response.download()
>
> > > def index():
> > >     response.flash=T('Welcome to web2py')
> > >     return dict(message=T('Hello World'))
>
> > > Now 
> > > visit:http://..../[app]/default/user/registerhttp://..../[app]/default/user/loginhttp://..../[app]/default/user/profilehttp://..../[app]/default/user/change_passwordhttp://..../[app]/default/user/groupshttp://..../[app]/default/user/logouthttp://..../[app]/default/user/retrieve_password
>
> > >http://..../[app]/default/database/tableshttp://..../[app]/default/database/select/[app]_eventhttp://..../[app]/default/database/create/[app]_eventhttp://..../[app]/default/database/read/[app]_event/1http://..../[app]/default/database/update/[app]_event/1http://..../[app]/default/database/delete/[app]_event/1
>
> > > now add to the model
>
> > > mail=Mail()
> > > mail.settings.server='smtp.whetever.com'
> > > mail.settings.sender='....@whatever.com'
> > > mail.settings.longin='username:password'
> > > auth.settings.mail=mail
>
> > > so that registration requires email verification
>
> > > then add
>
> > > auth.settings.captcha=RECAPTCHA
> > > (request,public_key='RECAPTCHA_PUBLIC_KEY',private_key='RECAPTCHA_PRIVATE_K
> > >  EY')
>
> > > so that registration will use recaptcha
>
> > > then add
>
> > > crud.auth=auth
>
> > > so that crud will enforce role based access control....
>
> > > now you lost the permission to accesshttp://.../database/....
>
> > > now give yourself back permission *only* to select record in table
> > > [app]_user
>
> > > group_id=auth.add_group(role='Manager')
> > > auth.add_membership(group_id,auth.user.id)
> > > auth.add_permission(group_id,'select','[app]_user')
>
> > > or to delete users
>
> > > auth.add_permission(group_id,'delete','[app]_user')
>
> > > get the idea?.... I think I have been following (or tried to) the
> > > advice of some of the members here like Yarko, Ceej, Bill, Fran, and
> > > others.
>
> > > There is a lot more stuff in there (like decorators that enforce
> > > permissions) that needs polishing and documenting.
>
> > > Volunteers to help?
>
> > > Massimo
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to