Thanks for the replies.

I deleted the tables themselves--not in app/databases but from the
mysql dir where they are kept.  I then use phpmyadmin to create an
empty d-b, as required when using mysql. (Yes, I read the db chapter
on the web2py book.)

I don't believe you are seeing a period in the db name; that is the
path to a table.

I believe this problem had some bizarre association with corruption in
the controller.

Here is the model file:

# pyjokes
# -*- coding: utf-8 -*-


jodb = DAL('mysql://root:mypwdfoo@localhost/jodb')   #not the actual
password!

from gluon.tools import *
auth = Auth(jodb)
auth.define_tables()
crud = Crud(jodb)

## configure email
mail=auth.settings.mailer
mail.settings.server = 'logging' or 'smtp.gmail.com:587'
mail.settings.sender = 'y...@gmail.com'
mail.settings.login = 'username:password'

## configure auth policy
auth.settings.registration_requires_verification = False
auth.settings.registration_requires_approval = False
auth.settings.reset_password_requires_verification = False

## if you need to use OpenID, Facebook, MySpace, Twitter, Linkedin,
etc.
## register with janrain.com, write your domain:api_key in private/
janrain.key
from gluon.contrib.login_methods.rpx_account import use_janrain
use_janrain(auth,filename='private/janrain.key')

#########################################################################
## Define your tables below (or better in another model file) for
example
##
## >>> db.define_table('mytable',Field('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.mytable.myfield=='value').select(db.mytable.ALL)
## >>> for row in rows: print row.id, row.myfield
#########################################################################

jodb.define_table('joke',
    Field('joketext', 'text',length=2048),
    Field('created_on', 'datetime', default=request.now),
    Field('created_by', jodb.auth_user, default=auth.user_id))

jodb.define_table('category',
    Field('name', 'text'))

jodb.define_table('joke_category',
    Field('joke_id', 'integer'),
    Field('category_id', 'integer'))

jodb.category.name.requires = IS_NOT_EMPTY()
jodb.joke.joketext.requires = IS_NOT_EMPTY()
#  jodb.joke_category.requires = IS_IN_DB(jodb,jodb.joke.id)  #this
didn't work for some reason

Reply via email to