I installed t2 and got some basic examples up and running ok using a
MySQL database. I want to test out some of the in-built columns, e.g.
created_on and modified_on so I added these to my tables and got the
"person table already exists" raised in my previous post.
So I deleted all the tables and ran my example again. This time it
failed in t2.py with
"Table 'onestepbeyond.t2_membership' doesn't exist"
It fails the same if I try "database administration". It is the same
even if I stop and start the server.
My db.py is as follows (note t2 def is up front compared to the
examples as I ref t2_person in 'newsitem' table):
-------------------------------------------------------------------------------------------------------
db=SQLDB('mysql://blah:[EMAIL PROTECTED]:3306/onestepbeyond')
from applications.plugin_t2.modules.t2 import T2
t2=T2(request,response,session,cache,T,db)
import datetime
now=datetime.datetime.now()
db.define_table('newsitem',
SQLField('created_on','datetime'),
SQLField('modified_on','datetime'),
SQLField('author_id',db.t2_person),
SQLField('title',length=50,required=True),
SQLField('summary',length=255,required=True),
SQLField('content','text',required=True),
SQLField('more_link',length=255,required=True,default=''),
SQLField('type',length=1,required=True,default=''),
SQLField('from_ts','datetime',required=True,default=now),
SQLField('to_ts','datetime',required=True))
db.define_table('lookup',
SQLField('created_on','datetime'),
SQLField('modified_on','datetime'),
SQLField('other','string',length=255,required=True,default=''),
SQLField('type','string',length=20,required=True),
SQLField('value','string',length=30,required=True))
db.lookup.type.requires=IS_IN_SET(['LookupType','Country','CustomTerm',
\
'GroupPreference','GroupShopping'])
db.lookup.value.requires=IS_NOT_EMPTY()
db.lookup.represent=lambda row:
A(row.value,_href=t2.action('update_lookup',[row.id]))
-------------------------------------------------------------------------------------------------------------------------------
If I replace the t2_person ref with 'integer' and move t2=T2(etc) to
the end, it fails because table 'newsitem' does NOT exist.
If I create a 'newsitem' table with just a 'author_id' column in it,
it fails in sql.py with "Commands out of sync."
Any ideas? Am I missing something obvious?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---