Odd. Here it is since it doesn't seem to want to email:
# coding: utf8
#########################################################################
## This scaffolding model makes your app work on Google App Engine too
#########################################################################
if request.env.web2py_runtime_gae: # if running on Google App Engine
from gluon.contrib.gql import *
### connect to Google BigTable
db = GQLDB()
## and store sessions and tickets there
session.connect(request, response, db=db)
### or use the following lines to store sessions in Memcache
# from gluon.contrib.memdb import MEMDB
# from google.appengine.api.memcache import Client
# session.connect(request, response, db=MEMDB(Client()))
else: # else use a normal relational database
# if not, use SQLite or other DB
db = SQLDB('postgres://webuser:w3bv...@localhost:5432/test')
#########################################################################
## uncomment the following line if you do not want sessions
#session.forget()
#########################################################################
#########################################################################
## Define your tables below, for example
##
## >>> db.define_table('mytable',SQLField('myfield','string'))
##
## Fields can be
'string','text','password','integer','double','boolean'
## 'date','time','datetime','blob','upload', 'reference
TABLENAME'
## There is an implicit 'id integer autoincrement' field
## Consult manual for more options, validators, etc.
##
## More API examples for controllers:
##
## >>> db.mytable.insert(myfield='value')
## >>> rows=db(db.mytbale.myfield=='value).select(db.mytable.ALL)
## >>> for row in rows: print row.id, row.myfield
#########################################################################
db.define_table('siteuser',
db.Field('user_id'),
db.Field('user_id__tmp'),
db.Field('firstname', length=128, default=''),
db.Field('lastname', length=128, default=''),
db.Field('email', length=128, default='', requires = [IS_EMAIL(),
IS_NOT_IN_DB(db,'%s.email'%'siteuser')]),
db.Field('password', 'password', readable=False, label='Password',
requires=CRYPT()),
db.Field('registration_key', length=128, writable=False,
readable=False,default=''),
db.Field('last_logged_in', type='datetime', default='now'),
db.Field('last_logged_in_from', length=36, default=''),
db.Field('created_on', type='datetime', default='now'),
db.Field('active', type='boolean', default=True)
)
db.define_table('game',
SQLField('name','string')
)
db.define_table('player',
SQLField('name','string'),
SQLField('game',db.game),
#SQLField('siteuser',db.siteuser),
SQLField('handgold','string',175)
)
#########################################################################
## Here is sample code if you need:
## - email capabilities
## - authentication (registration, login, logout, ... )
## - authorization (role based authorization)
## - services (xml, csv, json, xmlrpc, jsonrpc, amf, rss)
## - crud actions
## comment/uncomment as needed
#########################################################################
from gluon.tools import *
auth=Auth(globals(),db) # authentication/authorization
# define custom tables (table_user_name is 'auth_user')
#auth.settings.table_user_name = 'siteuser'
auth.settings.table_user = db.siteuser
auth.define_tables() # creates all needed tables
crud=Crud(globals(),db) # for CRUD helpers using auth
service=Service(globals()) # for json, xml, jsonrpc, xmlrpc,
amfrpc
## uncomment as necessary or consult docs for more options
#crud.settings.auth=auth # (optional) enforces authorization
on crud
#mail=Mail() # mailer
#mail.settings.server='smtp.gmail.com:587' # your SMTP server
#mail.settings.sender='[email protected]' # your email
#mail.settings.login='username:password' # your credentials
#auth.settings.mailer=mail # for user email verification
#auth.settings.registration_requires_verification = True
#auth.settings.registration_requires_approval = True
#auth.messages.verify_email = \
# 'Click on the link http://.../verify_email/%(key)s to verify your
email'
On Jul 1, 12:05 pm, mdipierro <[email protected]> wrote:
> did not get it: [email protected]
>
> On Jul 1, 10:47 am,RobScheibel <[email protected]> wrote:
>
> > Emailed. Thanks for looking at it for me!
>
> > -rob
>
> > On Jul 1, 9:45 am, mdipierro <[email protected]> wrote:
>
> > > can you please email me your db.py?
>
> > > On Jul 1, 5:12 am,RobScheibel <[email protected]> wrote:
>
> > > > Thanks for the quick reply! I added the line
> > > > "auth.settings.table_user=db.siteuser" and I'm still getting the same
> > > > error. Here's the traceback:
>
> > > > Traceback (most recent call last):
> > > > File "/home/rob/Desktop/web2py/gluon/restricted.py", line 107, in
> > > > restricted
> > > > exec ccode in environment
> > > > File "/home/rob/Desktop/web2py/applications/test/models/db.py", line
> > > > 87, in <module>
> > > > auth.define_tables() # creates all needed tables
> > > > File "/home/rob/Desktop/web2py/gluon/tools.py", line 528, in
> > > > define_tables
> > > > migrate=self.__get_migrate(self.settings.table_membership_name,
> > > > migrate))
> > > > File "/home/rob/Desktop/web2py/gluon/sql.py", line 989, in
> > > > define_table
> > > > query = t._create(migrate=migrate)
> > > > File "/home/rob/Desktop/web2py/gluon/sql.py", line 1341, in _create
> > > > sql_fields_aux, logfile)
> > > > File "/home/rob/Desktop/web2py/gluon/sql.py", line 1389, in _migrate
> > > > self._db._execute(sub_query)
> > > > File "/home/rob/Desktop/web2py/gluon/sql.py", line 761, in <lambda>
> > > > self._execute = lambda *a, **b: self._cursor.execute(*a, **b)
> > > > ProgrammingError: relation "siteuser" does not exist
>
> > > > Line #87 in db.py is: auth.define_tables()
>
> > > > -rob
>
> > > > On Jun 30, 5:53 pm, mdipierro <[email protected]> wrote:
>
> > > > > Try this:
>
> > > > > db.define_table(
> > > > > "siteuser",
> > > > > db.Field('user_id'),
> > > > > db.Field('user_id__tmp'),
> > > > > db.Field('firstname', length=128, default=''),
> > > > > db.Field('lastname', length=128, default=''),
> > > > > db.Field('email', length=128, default='', requires = [IS_EMAIL(),
> > > > > IS_NOT_IN_DB(db,'siteuser.email')]),
> > > > > db.Field('password', 'password', readable=False, label='Password',
> > > > > requires=CRYPT()),
> > > > > db.Field('registration_key', length=128, writable=False,
> > > > > readable=False,default=''),
> > > > > db.Field('last_logged_in', type='datetime', default='now'),
> > > > > db.Field('last_logged_in_from', length=36, default=''),
> > > > > db.Field('created_on', type='datetime', default='now'),
> > > > > db.Field('active', type='boolean', default=True)
> > > > > )
>
> > > > > auth=Auth(globals(),db) # authentication/authorization
> > > > > auth.settings.table_user_name = 'siteuser'
> > > > > auth.settings.table_user=db.siteuser ### this was missing
> > > > > auth.define_tables() # creates all needed tables
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---