My system is debian and web2py version is last ( manybe 1.99.7--web2py_src.zip )
I'm studying and there are many mistake in my codes studied. But there are many poor users in the good softwares like web2py. But there are some logical mistakes in reporting errors. I met the message --------------------------------------------- Traceback (most recent call last): File "/home/song/WEB2PY/web2py/gluon/restricted.py", line 205, in restricted exec ccode in environment File "/home/song/WEB2PY/web2py/applications/Working/views/default/index.html", line 58, in <module> File "/home/song/WEB2PY/web2py/gluon/tools.py", line 1217, in navbar if 'username' in self.settings.table_user.fields() and \ AttributeError: 'NoneType' object has no attribute 'fields' --------------------------------------------------------------- And the index.html has no lines 58 andd the source models/db.py is as ---------------- # -*- coding: utf-8 -*- ######################################################################### ## This scaffolding model makes your app work on Google App Engine too ## File is released under public domain and you can use without limitations ######################################################################### ## if SSL/HTTPS is properly configured and you want all HTTP requests to ## be redirected to HTTPS, uncomment the line below: # request.requires_https() if not request.env.web2py_runtime_gae: ## if NOT running on Google App Engine use SQLite or other DB db = DAL('sqlite://storage.sqlite') else: ## connect to Google BigTable (optional 'google:datastore://namespace') db = DAL('google:datastore') ## store sessions and tickets there session.connect(request, response, db = db) ## or store session in Memcache, Redis, etc. ## from gluon.contrib.memdb import MEMDB ## from google.appengine.api.memcache import Client ## session.connect(request, response, db = MEMDB(Client())) ## by default give a view/generic.extension to all actions from localhost ## none otherwise. a pattern can be 'controller/function.extension' response.generic_patterns = ['*'] if request.is_local else [] ## (optional) optimize handling of static files # response.optimize_css = 'concat,minify,inline' # response.optimize_js = 'concat,minify,inline' ######################################################################### ## Here is sample code if you need for ## - email capabilities ## - authentication (registration, login, logout, ... ) ## - authorization (role based authorization) ## - services (xml, csv, json, xmlrpc, jsonrpc, amf, rss) ## - old style crud actions ## (more options discussed in gluon/tools.py) ######################################################################### from gluon.tools import Auth, Crud, Service, PluginManager, prettydate auth = Auth(db, hmac_key=Auth.get_or_create_key()) crud, service, plugins = Crud(db), Service(), PluginManager() ## create all tables needed by auth if not custom tables auth.define_tables() ## configure email mail=auth.settings.mailer mail.settings.server = 'logging' or 'smtp.gmail.com:587' mail.settings.sender = 'taesun.s...@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 = True ## 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 ######################################################################### import datetime; now=datetime.date.today() # # try something like # db=DAL("sqlite://db.db") # db for category # db.define_table('category', Field('name') ) db.define_table('category_description', Field('name'), Field('Levels'), Field('author'), Field('date','date',default=now), Field('description', 'text') ) ## end for category # # db for image # db.define_table('show', Field('name')) db.define_table('image', Field('show',db.show), Field('LEVEL1',db.category), Field('LEVEL2',db.category), Field('LEVEL3',db.category), Field('title'), # Field('given_by'), Field('Descriptions','text'), Field('file','upload') ) db.show.name.requires=[IS_NOT_EMPTY(),IS_NOT_IN_DB(db,db.show.name)] db.image.show.requires=IS_IN_DB(db,db.show.id,'%(name)s') db.category.name.requires=[IS_NOT_EMPTY(),IS_NOT_IN_DB(db,db.category.name)] db.image.LEVEL1.requires=IS_IN_DB(db,db.category.id,'%(name)s') db.image.LEVEL2.requires=IS_IN_DB(db,db.category.id,'%(name)s') db.image.LEVEL3.requires=IS_IN_DB(db,db.category.id,'%(name)s') ## end for image # # # for recipe # db.define_table('recipe', Field('title'), Field('description',length=256), Field('category',db.category), Field('date','date',default=now), Field('instructions','text')) db.category.name.requires=[IS_NOT_EMPTY(),IS_NOT_IN_DB(db,'category.name')] db.recipe.title.requires=[IS_NOT_EMPTY()] db.recipe.description.requires=IS_NOT_EMPTY() ## end for cookbooks # # db for country and city # db.define_table('country', Field('iso'), Field('name'), Field('printable_name'), Field('iso3'), Field('numcode') ) db.define_table('city_address', Field('country_id',db.country), Field('district'), Field('city') ) ## end for country and city # # # db for persons and users # db.define_table('person', Field('first_name'), Field('last_name'), Field('email') ) db.define_table('user', Field('person_id',db.person), Field('city_address_id',db.city_address), Field('address'), Field('Phones'), Field('Eductions',), Field('Birthday'), Field('Emails'), Field('Nationality'), Field('Languages'), Field('Hobbies'), Field('Workings'), Field('Families'), Field('Medical'), Field('Others') ) ## end for persons and users db.define_table('blog', Field('title'), Field('owner_name'), Field('owner_email'), Field('owner_phone') ) db.define_table('Topics', Field('title'), Field('owner_name'), Field('owner_email'), Field('owner_phone'), Field('staff_name'), Field('administrator_name') ) db.define_table('Forums', Field('title'), Field('owner_name'), Field('owner_email'), Field('owner_phone'), Field('staff_name'), Field('administrator_name') ) db.define_table('Hobbies', Field('title'), Field('owner_name'), Field('owner_email'), Field('owner_phone'), Field('staff_name'), Field('administrator_name') ) auth.settings.registration_requires_approval = True auth.settings.actions_disabled.append('register') auth.define_tables() # # #def user(): # return dict(form=auth()) # # # after # auth = Auth(globals(),db) db.define_table( auth.settings.table_user_name, Field('first_name', length=128, default=''), Field('last_name', length=128, default=''), Field('email', length=128, default='', unique=True), Field('username', length=128, default='', unique=True), Field('password', 'password', length=512, readable=False, label='Password'), Field('registration_key', length=512, writable=False, readable=False, default=''), Field('reset_password_key', length=512, writable=False, readable=False, default=''), Field('registration_id', length=512, writable=False, readable=False, default='')) #auth_table.first_name.requires = IS_NOT_EMPTY(error_message=auth.messages.is_empty) #auth_table.last_name.requires = IS_NOT_EMPTY(error_message=auth.messages.is_empty) #auth_table.password.requires = [IS_STRONG(), CRYPT()] #auth_table.email.requires = [ # IS_EMAIL(error_message=auth.messages.invalid_email), # IS_NOT_IN_DB(db, auth_table.email)] #auth_table.username.requires = IS_NOT_IN_DB(db, auth_table.username) #auth.settings.table_user = auth_table auth.settings.table_user_name = 'auth_user' auth.settings.table_group_name = 'auth_group' auth.settings.table_membership_name = 'auth_membership' auth.settings.table_permission_name = 'auth_permission' auth.settings.table_event_name = 'auth_event' auth = Auth(globals(),db) auth.settings.table_user_name = 'person' # before # auth.define_tables() ------------ And the index.html {{left_sidebar_enabled,right_sidebar_enabled=False,True}} {{extend 'layout.html'}} {{if 'message' in globals():}} <h3>{{=message}}</h3> <h4/>{{=T('How are you, my Friends?')}}</h4> <ol> <li>{{=T('You are visiting my site')}}</li> <li>{{=T('If you are the 1st visitor in my site and you must register.')}}</li> <li>{{=T('Others, you can login!')}}</li> <li> {{=T('')}} {{=T('Number of Visits:')}} {{=counter}} <li>{{=T('The output of the file is a dictionary that was rendered by the view')}} {{=A('web2py/applications/%(application)s/views/%(controller)s/index.html'%request,_href=URL('admin','default','peek',args=(request.application,'views',request.controller,'index.html')))}}</li> <li>{{=T('You can modify this application and adapt it to your needs')}}</li> </ul> </ol> {{else:}} {{=BEAUTIFY(response._vars)}} {{pass}} {{block right_sidebar}} <h4>{{=T("Don't know what to do?")}}</h4> <ul> <li>{{=A(T("Visit Topics"), _href=URL('admin','default','index'))}}</li> <li>{{=A(T("Visit Forums"), _href=URL('Working','default','index'))}}</li> <li>{{=A(T("Visit Blog"), _href=URL('examples','default','index'))}}</li> <li>{{=A(T("Visit Hobbies"), _href=URL('examples','default','index'))}}</li> <li>{{=A(T("Visit Person"), _href=URL('examples','default','index'))}}</li> <li><a href="http://web2py.com">web2py.com</a></li> <li><a href="http://web2py.com/book">{{=T('Documentation')}}</a></li> </ul> {{end}} ----------- 2012년 6월 14일 목요일 오전 11시 31분 2초 UTC+9, pbreit 님의 말: > > We need to see your code, what edits you made and what error messages you > are receiving. The more information you can provide, the better we are able > to help.