Here it is I have commented much whilst testing for mistake
thanks for any help
chrism
--------------
model:
import uuid
try:
from gluon.contrib.gql import * # if running on Google App Engine
except:
db = SQLDB('sqlite://storage.db') # if not, use SQLite or other
DB
else:
db = GQLDB() # connect to Google BigTable
session.connect(request, response, db=db) # and store sessions
there
from gluon.tools import *
crud=Crud(globals(),db)
mail=Mail()
mail.settings.server='gae'
# mail.settings.sender='[email protected]'
# only configure login if you need smtp authentication
# check your regular mail setup
# mail.settings.login='[email protected]:lombok01'
# db.define_table('auth_user',
# SQLField('first_name',length=32,default=''),
# SQLField('last_name',length=50,default=''),
# SQLField('email',requires=IS_EMAIL()),
# SQLField('password','password',requires=CRYPT()),
# SQLField('registration_key',length=64),
# SQLField('pic','upload',default=''))
auth=Auth(globals(),db)
##auth.settings.mailer=mail
#auth.settings.table_user=db.auth_user
auth.define_tables()
#group_id=auth.add_group('Project','can access the manage action')
#auth.add_permission(group_id,'access to manage')
#auth.add_membership(group_id)
import datetime; now=datetime.datetime.today()
#now=request.now
db.define_table('page',
# SQLField('timestamp','double',default=now),
SQLField('uuid',length=128,writable=False,default=str(uuid.uuid4
())),
SQLField('timestamp','datetime',default=now,writable=False),
SQLField('title'),
SQLField('body','text'))
# db.define_table('comment',
# SQLField('timestamp','datetime',default=now),
# SQLField('page',db.page),
# SQLField('author_name'),
# SQLField('author_email'),
# SQLField('body','text'))
def fullurl(a=None,c=None,f=None,r=None,args=[],vars={}):
return '%s://%s%s' % (r.env.wsgi_url_scheme,r.env.http_host,URL
(a=a,c=c,f=f,r=r,args=args,vars=vars))
auth.messages.verify_email = \
'Click on the link ' + fullurl(r=request,f='user',args=
['verify_email']) + '/%(key)s to verify your email'
# db.define_table('person',
# SQLField('alias'),
# SQLField('email'),
# SQLField('password','password'),
# SQLField('post_time','double',default=now),
# SQLField('favorites','text'))
# db.person.alias.requires=[IS_NOT_EMPTY(), IS_NOT_IN_DB
(db,db.person.alias)]
# db.person.email.requires=[IS_EMAIL(), IS_NOT_IN_DB
(db,db.person.email)]
db.define_table('comment',
SQLField('uuid',length=128,writable=False,default=str(uuid.uuid4
())),
SQLField('score','integer',default=1),
SQLField('timestamp','datetime',default=now,writable=False),
SQLField('page',db.page),
SQLField('author_name',db.auth_user),
SQLField('author_alias'),
SQLField('author_email'),
SQLField('parente','integer',default=0),
##SQLField('prodj',db.prodj),
SQLField('body','text'),
SQLField('flagged','boolean',default=False))
db.comment.body.requires=IS_NOT_EMPTY()
db.define_table('document',
SQLField('uuid',length=128,writable=False,default=str(uuid.uuid4())),
SQLField('timestamp','datetime',default=now,writable=False),
SQLField('page',db.page),
SQLField('name'),
SQLField('file','upload'))
## db.page.title.requires=[IS_NOT_EMPTY(),IS_NOT_IN_DB
(db,'page.title')]
db.page.body.requires=IS_NOT_EMPTY()
db.comment.page.requires=IS_IN_DB(db,'page.id','%(title)s')
# db.comment.author_name.requires=IS_NOT_EMPTY()
# db.comment.author_email.requires=IS_EMAIL()
db.comment.body.requires=IS_NOT_EMPTY()
db.document.page.requires=IS_IN_DB(db,'page.id','%(title)s')
db.document.name.requires=[IS_NOT_EMPTY(),IS_NOT_IN_DB
(db,'document.name')]
On Mar 29, 3:18 pm, mdipierro <[email protected]> wrote:
> Can I see the model for db.page
>
> On Mar 29, 6:37 am, murray3 <[email protected]> wrote:
>
> > I posted this when I got up - must have been still asleep as problem
> > is withcreat function
> > as it is not working there probably is nothing in db table to select?
> > Here is code for create controller and subsequent error output from
> > GAE.
>
> > Controller:
> > def create():
> > "creates a new empty wiki page"
> > myform=SQLFORM(db.page,fields=['title','body'])
> > if myform.accepts(request.vars,session):
> > session.flash='page saved'
> > redirect(URL(r=request,f='index'))
> > elif myform.errors: response.flash='page not saved'
> > return dict(form=myform)
>
> > error output from GAE:
>
> > /navBG.png HTTP/1.1" 200 -
> > INFO 2009-03-29 11:31:12,467 dev_appserver.py] "GET /fabmonger/
> > static/images
> > /navHover.png HTTP/1.1" 200 -
> > WARNING 2009-03-29 11:31:35,078 cache.py] no cache.disk
> > ERROR 2009-03-29 11:31:35,203 main.py] Traceback (most recent call
> > last):
> > File "c:\apps\web2py\gluon\restricted.py", line 98, in restricted
> > exec ccode in environment
> > File "c:\apps\web2py\applications\fabmonger/controllers/default.py",
> > line 205,
> > in <module>
> > File "c:\apps\web2py\gluon\globals.py", line 75, in <lambda>
> > self._caller = lambda f: f()
> > File "c:\apps\web2py\applications\fabmonger/controllers/default.py",
> > line 57,
> > in create
> > if myform.accepts(request.vars,session):
> > File "c:\apps\web2py\gluon\sqlhtml.py", line 561, in accepts
> > self.vars.id = self.table.insert(**fields)
> > File "c:\apps\web2py\gluon\contrib\gql.py", line 297, in insert
> > self[field].type, self._db)
> > File "c:\apps\web2py\gluon\contrib\gql.py", line 503, in
> > obj_represent
> > obj = float(obj)
> > TypeError: float() argument must be a string or a number
>
> > INFO 2009-03-29 11:31:35,250 dev_appserver.py] "POST /fabmonger/
> > default/crea
> > te HTTP/1.1" 200 -
>
> > again any help appreciated
> > chrism
>
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---