Hello!
I got error message with postgress:
Traceback (most recent call last):
File "/home/alex/web2py/gluon/restricted.py", line 62, in restricted
exec ccode in environment
File "/home/alex/web2py/applications/monitoring/models/db.py", line
25, in <module>
SQLField('failed_attempts','integer',default=0))
File "/home/alex/web2py/gluon/sql.py", line 575, in define_table
raise e
ProgrammingError: syntax error at or near "user"
LINE 1: CREATE TABLE user(
I'm using web2py Version 1.54 and postgress 8.3.5.
Application works fine with sqlight, so I think I missed something
specific for postgress.
I tried cleanup all files in databases folder - nothing. Everything
works
with sqlight but never with postgress. Login/pass are OK. Any ideas ?
my models:
import random
import time; now=time.time()
import datetime;
timestamp=datetime.datetime.today()
today=datetime.date.today()
#need for checking references
if session.token:
owner_id,owner_email,owner_name=session.token
else:
owner_id=owner_email=owner_name=''
#db=SQLDB("sqlite://monitoring.db")
db=SQLDB("postgres://aaa:[email protected]/aaa")
db.define_table('user',
SQLField('name'),
SQLField('email'),
SQLField('password','password'),
SQLField('verification',default=''),
SQLField('last_attempt_time','integer',default=0),
SQLField('failed_attempts','integer',default=0))
db.user.name.requires=IS_NOT_EMPTY()
db.user.email.requires=[IS_EMAIL(),IS_NOT_IN_DB(db,'user.email')]
db.define_table('ticket',
SQLField('ctime','integer',default=now),
SQLField('url'),
SQLField('code'),
SQLField('user',db.user))
VALID_USER=IS_IN_DB(db(db.user.verification==''),'user.id','%(id)s:%
(name)s')
db.define_table('allert_contacts',
SQLField('type'),
SQLField('contact_str',length=128),
SQLField('owner',db.user))
db.define_table('services',
SQLField('url',length=128,default='http://localhost'),
SQLField('check_interval','integer',default=10),
SQLField('allert_id',db.allert_contacts),
SQLField('owner',db.user))
db.define_table('services_statuses',
SQLField('service_id',db.services),
SQLField('last_checked','datetime'),
SQLField('down_since','datetime')
)
db.define_table('history',
SQLField('downtime_st','datetime'),
SQLField('downtime_end','datetime'),
SQLField('service_id',db.services)
)
#referensing to proper contect - can we do other way ?
db.services.allert_id.requires=IS_IN_DB(db
(db.allert_contacts.owner==owner_id),'allert_contacts.id','allert_contacts.contact_str')
db.services.url.requires=IS_URL()
db.services.check_interval.requires=IS_INT_IN_RANGE(1,1000)
db.services.owner.requires=VALID_USER
# do we realy need this ? Potential slowdown becaus of foreight key
db.history.service_id.requires=IS_IN_DB
(db,'services.id','services.id')
#type of contacts
db.allert_contacts.type.requires=IS_IN_SET(['email','phone','url'])
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---