# view
    #show.html
    {{extend 'layout.html'}}
    <h1>{{=page.title}}</h1>
    [ {{=A('edit', _href=URL('edit', args=request.args))}} ]<br />
    {{=MARKMIN(page.body)}}
    <h2>Comments</h2>
    {{for post in comments:}}
      <p>{{=db.auth_user[post.created_by].first_name}} on 
{{=post.created_on}}
         says <i>{{=post.body}}</i></p>
    {{pass}}
    <h2>Post a comment</h2>
    {{=form}}
    
    #controller
    #default.py
    def user():
        return dict(form=auth())
    @auth.requires_login()
    def index():
        pages = 
db().select(db.course.id,db.course.title,db.course.Instructor,orderby=db.course.title)
        return dict(pages=pages)
    @auth.requires_login()
    def createcourse():
         """creates a new empty wiki page"""
         form = SQLFORM(db.course).process(next=URL('index'))
         return dict(form=form)
    def show():
         """shows a wiki page"""
         this_page = db.course(request.args(0,cast=int)) or 
redirect(URL('index'))
         db.post.course_id.default = this_page.id
         form = SQLFORM(db.post).process() if auth.user else None
         pagecomments = db(db.post.course_id==this_page.id).select()
         return dict(page=this_page, comments=pagecomments, form=form)
    
    #model
    #db.py
    db = DAL("sqlite://storage.sqlite")
    from gluon.tools import Auth
    auth = Auth(db)
    auth.define_tables(username=True)
    db.define_table('course',
       Field('title', unique=True),
       Field('Instructor','text', unique=True),
       Field('Dateofcoursecreation','datetime'),
                    Field('Courseid'),
       format = '%(title)s')
    
    db.define_table('post',
        Field('course_id'),
        Field('body', 'text'),
        Field('created_on', 'datetime', default=request.now),
        Field('created_by', 'reference auth_user', default=auth.user_id))

#ticket issued

Error ticket for "courseapp"
Ticket ID

127.0.0.1.2016-03-16.20-55-17.d72cc1b2-28ab-4aea-be40-a372034830a5
<type 'exceptions.AttributeError'>
Version
web2py™     Version 2.13.4-stable+timestamp.2015.12.26.04.59.39
Python     Python 2.7.6: /usr/bin/python (prefix: /usr)
Traceback

1.
2.
3.
4.
5.
6.
7.
8.

    

Traceback (most recent call last):
  File "/home/nikhil/Downloads/web2py/gluon/restricted.py", line 227, in 
restricted
    exec ccode in environment
  File 
"/home/nikhil/Downloads/web2py/applications/courseapp/views/default/show.html", 
line 79, in <module>
  File "/home/nikhil/Downloads/web2py/gluon/packages/dal/pydal/objects.py", 
line 90, in __getattr__
    raise AttributeError
AttributeError

Error snapshot help

<type 'exceptions.AttributeError'>()

inspect attributes
Frames

    File /home/nikhil/Downloads/web2py/gluon/restricted.py in restricted at 
line 227 code arguments variables

    File 
/home/nikhil/Downloads/web2py/applications/courseapp/views/default/show.html 
in <module> at line 79 code arguments variables

    File /home/nikhil/Downloads/web2py/gluon/packages/dal/pydal/objects.py 
in __getattr__ at line 90 code arguments variables
    Function argument list

    (self=<Row {'title': 'maths', 'Dateofcoursecreation': ... 'Instructor': 
'indranil chakrabarty', 'id': 1L}>, k='body')
    Code listing

    85.
    86.
    87.
    88.
    89.
    90.

    91.
    92.
    93.
    94.

        


        def __getattr__(self, k):
            try:
                return self.__getitem__(k)
            except KeyError:
                raise AttributeError


        def __copy__(self):
            return Row(self)

    Variables
    builtinAttributeError     <type 'exceptions.AttributeError'>


please can any one say me where is the mistake.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to