I seem to have broken the db portion of appadmin on my app somehow.
It throws this error:

Traceback (most recent call last):
  File "C:\web2py\gluon\restricted.py", line 107, in restricted
    exec ccode in environment
  File "C:/web2py/applications/web2pyslices/views/appadmin.html", line
248, in <module>
AttributeError: 'str' object has no attribute 'slices'

This is the 'slices' definition:

db.define_table('categories',
                SQLField('name','string')
                )
db.define_table('slices',
                SQLField('title','string',length=128),
                SQLField('notes','text'),
                SQLField('slice','text'),
                SQLField('category',db.categories),
                SQLField('author',db.auth_user),
                SQLField('posted','datetime'),
                SQLField('tags','string',length=128),
                SQLField
('rating','integer')
                )
db.define_table('ratings',
                SQLField('slice_id',db.slices),
                SQLField('user_id',db.auth_user),
                SQLField('rating','integer')
                )
db.define_table('tags',
                SQLField('name','string'),
                SQLField('count','integer')
                )
db.define_table('favorites',
                SQLField('slice_id',db.slices),
                SQLField('user_id',db.auth_user)
                )

from gluon.contrib.markdown import WIKI
db.slices.category.represent = lambda id: SPAN(db.categories[id].name)
db.slices.category.requires = IS_IN_DB(db,'categories.id','%(name)s')

db.slices.author.represent = lambda id: SPAN(db.auth_user
[id].username)
db.slices.author.requires = IS_IN_DB(db,'auth_user.id','%(username)s')
if auth.is_logged_in():
    db.slices.author.default = auth.user.id

db.slices.slice.represent = lambda value: XML(WIKI(value))
db.slices.slice.requires = IS_NOT_EMPTY(error_message='Coffee
anyone?')

db.slices.notes.requires = IS_NOT_EMPTY(error_message="Just a few
words will do")

db.slices.posted.default = request.now
db.slices.posted.writable = False

db.slices.rating.requires = IS_IN_SET(range(0,6))
db.slices.rating.default = 0

db.ratings.rating.requires = IS_IN_SET(range(0,6))

db.slices.tags.requires = IS_NOT_EMPTY(error_message='Help us help
you')

db.slices.title.requires = IS_NOT_EMPTY("You didn't get very far")

db.favorites.slice_id.requires = IS_NOT_EMPTY()
db.favorites.user_id.requires = IS_NOT_EMPTY()

db.categories.name.requires = IS_NOT_IN_DB(db,"categories.name")

I am running from the latest trunk on Python 2.5 in Windows.  Any
ideas?



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to