it gives me an error :

web2py™ administrative interface
site
edit
about
errors
versioning
logout
help
ERROR TICKET FOR "AZEZ_BLOGS"
TICKET ID
127.0.0.1.2011-07-26.19-44-44.cf0e1a41-6450-4144-bb1b-b8aad512a50a

VERSION
web2py™ Version 1.96.4 (2011-06-07 21:08:15)
Python  Python 2.5.4: C:\Users\Hassan\Desktop\web2py\web2py.exe
TRACEBACK
1.
2.
3.
4.
5.
6.
7.
8.
Traceback (most recent call last):
  File "gluon/restricted.py", line 192, in restricted
  File "C:/Users/Hassan/Desktop/web2py/applications/Azez_blogs/
controllers/default.py", line 124, in <module>
  File "gluon/globals.py", line 137, in <lambda>
  File "C:/Users/Hassan/Desktop/web2py/applications/Azez_blogs/
controllers/default.py", line 34, in index
  File "C:/Users/Hassan/Desktop/web2py/applications/Azez_blogs/
controllers/default.py", line 15, in getpostsandcomments
NameError: global name 'image' is not defined
ERROR SNAPSHOT
<type 'exceptions.NameError'>(global name 'image' is not defined)

inspect attributes

Frames
File C:\Users\Hassan\Desktop\web2py\gluon\restricted.py in restricted
at line 192
code

arguments

variables

File C:\Users\Hassan\Desktop\web2py\applications\Azez_blogs\controllers
\default.py in <module> at line 124
code

arguments

variables

File C:\Users\Hassan\Desktop\web2py\gluon\globals.py in <lambda> at
line 137
code

arguments

variables

File C:\Users\Hassan\Desktop\web2py\applications\Azez_blogs\controllers
\default.py in index at line 34
code

arguments

variables

File C:\Users\Hassan\Desktop\web2py\applications\Azez_blogs\controllers
\default.py in getpostsandcomments at line 15
code

arguments

variables

Function argument list
()

Code listing
10.
11.
12.
13.
14.
15.

16.
17.
18.
19.

    blogpostss= db().select(db.blogposts.ALL,
orderby=~db.blogposts.datetime)
    blogposts_numcomments = db().select(db.blogposts.ALL,
orderby=~db.blogposts.numcomments|~db.blogposts.datetime)
    commentsnposts = db(db.blogcomments.blogpost_id ==
db.blogposts.id)
    comments = commentsnposts.select(db.blogcomments.author,
db.blogcomments.blogpost_id, db.blogposts.title,
orderby=~db.blogcomments.datetime)
    images=db(image.blog_id==blogposts.id).select(db.image.ALL)

    youtube=db().select(db.youtube.ALL)
    vimo=db().select(db.vimo.ALL)

    return dict(blogposts=blogposts,
blogposts_numcomments=blogposts_numcomments,
comments=comments,images=images,youtube=youtube,vimo=vimo)
Variables
Context
locals

request

session

response

IN FILE: C:\USERS\HASSAN\DESKTOP\WEB2PY\APPLICATIONS\AZEZ_BLOGS
\CONTROLLERS/DEFAULT.PY
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
72.
73.
74.
75.
76.
77.
78.
79.
80.
81.
82.
83.
84.
85.
86.
87.
88.
89.
90.
91.
92.
93.
94.
95.
96.
97.
98.
99.
100.
101.
102.
103.
104.
105.
106.
107.
108.
109.
110.
111.
112.
113.
114.
115.
116.
117.
118.
119.
120.
121.
122.
123.
124.
125.
# -*- coding: utf-8 -*-
# this file is released under public domain and you can use without
limitations

#########################################################################
import datetime
#db.youtube.blog_id == db.blogposts.id
#db.vimo.blog_id == db.blogposts.id
#db.image.blog_id == db.blogposts.id
def getpostsandcomments():

    blogpostss= db().select(db.blogposts.ALL,
orderby=~db.blogposts.datetime)
    blogposts_numcomments = db().select(db.blogposts.ALL,
orderby=~db.blogposts.numcomments|~db.blogposts.datetime)
    commentsnposts = db(db.blogcomments.blogpost_id ==
db.blogposts.id)
    comments = commentsnposts.select(db.blogcomments.author,
db.blogcomments.blogpost_id, db.blogposts.title,
orderby=~db.blogcomments.datetime)
    images=db(image.blog_id==blogposts.id).select(db.image.ALL)
    youtube=db().select(db.youtube.ALL)
    vimo=db().select(db.vimo.ALL)

    return dict(blogposts=blogposts,
blogposts_numcomments=blogposts_numcomments,
comments=comments,images=images,youtube=youtube,vimo=vimo)

#########################################################################
def createblogpost():

        myd = getpostsandcomments()
 
form=SQLFORM(db.blogposts,fields=['title','post','author','video','audio'])
        if form.accepts(request.vars,session):
         response.flash='new blogpost inserted'
         redirect('/' + request.application + "/default/index")
        myd['form'] = form
        return myd

def index():

    return getpostsandcomments()

def createblogpost():

        myd = getpostsandcomments()
        form=SQLFORM(db.blogposts,fields=['title','post','author'])
        if form.accepts(request.vars,session):
         response.flash='new blogpost inserted'
         redirect('/' + request.application + "/default/index")
        myd['form'] = form
        return myd



def showblogpost():
    images=db(db.image.blog_id ==
db.blogposts.id).select(db.image.ALL)
    youtube=db(db.youtube.blog_id ==
db.blogposts.id).select(db.youtube.ALL)
    vimo=db(db.vimo.blog_id == db.blogposts.id).select(db.vimo.ALL)
    myd = getpostsandcomments()

    blogid = request.args[0]
    singleblogpost = db(db.blogposts.id == blogid).select()[0]
    singleblogpost_comments = db(db.blogcomments.blogpost_id ==
blogid).select(orderby=~db.blogcomments.datetime)

    db.blogcomments.blogpost_id.default=singleblogpost.id
    form=SQLFORM(db.blogcomments,fields=['author', 'email',
'comment'],labels={'author':'Your Name', 'email':'Your email address',
'comment':'Comment'})
    if form.accepts(request.vars,session):
        blogpostupdate=db(db.blogposts.id==blogid).select()
        if len(blogpostupdate)>0:
 
blogpostupdate[0].update_record(numcomments=blogpostupdate[0].numcomments
+ 1)
        redirect('/' + request.application + "/default/showblogpost/"
+ str(singleblogpost.id) + "#Reader_Comments")

    myd['form'] = form
    myd['singleblogpost'] = singleblogpost
    myd['singleblogpost_comments'] = singleblogpost_comments
    return myd
    return dict(images=images,youtube=youtube,vimo=vimo)

def user():
    """
    exposes:
    http://..../[app]/default/user/login
    http://..../[app]/default/user/logout
    http://..../[app]/default/user/register
    http://..../[app]/default/user/profile
    http://..../[app]/default/user/retrieve_password
    http://..../[app]/default/user/change_password
    use @auth.requires_login()
        @auth.requires_membership('group name')
        @auth.requires_permission('read','table name',record_id)
    to decorate functions that need access control
    """
    return dict(form=auth())


def download():
    """
    allows downloading of uploaded files
    http://..../[app]/default/download/[filename]
    """
    return response.download(request,db)


def call():
    """
    exposes services. for example:
    http://..../[app]/default/call/jsonrpc
    decorate with @services.jsonrpc the functions to expose
    supports xml, json, xmlrpc, jsonrpc, amfrpc, rss, csv
    """
    return service()


@auth.requires_signature()
def data():
    """
    http://..../[app]/default/data/tables
    http://..../[app]/default/data/create/[table]
    http://..../[app]/default/data/read/[table]/[id]
    http://..../[app]/default/data/update/[table]/[id]
    http://..../[app]/default/data/delete/[table]/[id[
    http://..../[app]/default/data/select/[table]
    http://..../[app]/default/data/search/[table]
    but URLs bust be signed, i.e. linked with
      A('table',_href=URL('data/tables',user_signature=True))
    or with the signed load operator
 
LOAD('default','data.load',args='tables',ajax=True,user_signature=True)
    """
    return dict(form=crud())

response._vars=response._caller(index)
Powered by web2py™ created by Massimo Di Pierro ©2007-2010 - Admin
language

Reply via email to