On Apr 22, 12:18 pm, Jonathan Lundell <jlund...@pobox.com> wrote:
> On Apr 22, 2010, at 9:32 AM, Patrick wrote:
>
> > I'm sorry your solution *does* work, I misread it in the reply, the
> > formatting got off and I was treating it like a separate variable. So
> > it works! When you first start web2py the user gets created (and every
> > time the user gets deleted as well. I'll figure out a better way to do
> > this later on. For now call this a feature). But the password gets set
> > properly and you can login and perform actions as the user. Thanks for
> > all the suggestions, until next time.
>
> I use something like this to make it happen once. This isn't necessarily the 
> test you want, but it's adaptable.
>
> if not db(auth.settings.table_group.id>0).count():
>     ...do your thing...
>

Thank you so much! I looked at your example and was able to create
something simply usable.
Can't believe I'm coding...

# default credentials. at least *one* user must exist or the default
"ticket master" user
# will be created.
fname='ticket'
lname='master'
maile='tmas...@localhost'
passwd='tmaster09!'
# Johnathan's suggestion on running this once. Works like a charm.
# Thank you Massimo for the password part.
if not db(db.auth_user.id>0).count():
 
ticket_master=db.auth_user.insert(first_name=fname,last_name=lname,email=maile,
                                
password=db.auth_user.password.requires[0](passwd)[0])
else:
    pass


-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en

Reply via email to