Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/errors/127.0.0.1.2010-07-08.15-35-45.6467e2f5-f182-4dcc-b8c0-8b4c7f6ee7d3
blob: f9d051cb07500467a0f4283ad23f5502fadb11b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
(dp1
S'output'
p2
S''
sS'layer'
p3
S'/home/jboisture/Desktop/web2py/applications/turtlesite/controllers/default.py'
p4
sS'code'
p5
S'import os\n\ndef index():\n  if "page" in request.vars.keys(): page = int(request.vars["page"]) - 1\n  else: page = 0\n  table = []\n  images = db().select(db.image.ALL)\n  i = 0\n  row = []\n  count = 0\n  for image in images:\n      if count >= page * 12 and page*12+12 > count:\n          if i == 4:\n              table.append(row)\n              row = []\n              i = 0\n          i += 1\n          row.append(image)\n      count += 1\n  table.append(row)\n  pages = count / 12\n  if count%12 > 0: pages += 1\n  page += 1\n  return dict(images=table, pages=pages, page=page)\n\ndef profile():\n  if "user" in request.vars.keys(): user = request.vars["user"]\n  else: redirect(URL(r=request, f=\'index\')) \n  if "page" in request.vars.keys(): page = int(request.vars["page"]) - 1\n  else: page = 0\n  table = []\n  user_pics = []\n  images = db().select(db.image.ALL)\n  for image in images:\n      if image.creator == user:\n          print user, image.creator\n          user_pics.append(image)\n  i = 0\n  row = []\n  count = 0\n  print page\n  for image in user_pics:\n      if count >= page * 12 and page*12+12 > count:\n          if i == 4:\n              table.append(row)\n              row = []\n              i = 0\n          i += 1\n          row.append(image)\n      count += 1\n  table.append(row)\n  pages = count / 12\n  if count%12 > 0: pages += 1\n  page += 1\n  return dict(images=table, pages=pages, page=page, user=user)\n\ndef upload():\n    form = SQLFORM(db.image, fields = [\'title\', \'file\', \'newimage\', \'description\'])\n    if form.accepts(request.vars, session):\n      session.new_image_title = form.vars.title\n      db(db.image.title==session.new_image_title).update(creator = auth.user.username)\n      redirect(URL(r=request, f=\'index\')) \n    return dict(form=form)\n\n\ndef image():\n   images = db().select(db.image.ALL)\n   title = request.vars["title"].replace(\'*\',\' \')\n   for image in images:\n       if image.title == title:\n           real_image = image\n   if auth.is_logged_in():\n       form = SQLFORM(db.comment, fields = [\'body\'])\n       if form.accepts(request.vars, session):\n           db(db.comment.comment_id==form.vars.id).update(author = auth.user.username)\n           db(db.comment.comment_id==form.vars.id).update(image_id = real_image.image_id)\n   comments=db().select(db.comment.ALL)\n   image_comments = []\n   for comment in comments:\n       if comment.image_id == real_image.image_id:\n            image_comments.append(comment)\n   import pdb\n   pdb.set_trace()\n   return dict(image = real_image, form= form,comments=image_comments)\n   \n  \ndef testimage():\n\treturn db(db.image.title=="hellotest")\n\ndef user(): \n  return dict(form=auth())\n\ndef delete():\n   images = db().select(db.image.ALL)\n   title = request.vars["title"].replace(\'*\',\' \')\n   for image in images:\n       if image.title == title:\n           real_image = image\n   if auth.is_logged_in():\n       if auth.user.username == real_image.creator:\n           query=(db.image.id==real_image.id)\n           db(query).delete()\n   redirect(URL(r=request, f=\'index\')) \n  \n  \ndef download():\n  return response.download(request, db)\n\nresponse._vars=response._caller(image)\n'
p6
sS'traceback'
p7
S'Traceback (most recent call last):\n  File "/home/jboisture/Desktop/web2py/gluon/restricted.py", line 178, in restricted\n    exec ccode in environment\n  File "/home/jboisture/Desktop/web2py/applications/turtlesite/controllers/default.py", line 109, in <module>\n  File "/home/jboisture/Desktop/web2py/gluon/globals.py", line 96, in <lambda>\n    self._caller = lambda f: f()\n  File "/home/jboisture/Desktop/web2py/applications/turtlesite/controllers/default.py", line 84, in image\n  File "/home/jboisture/Desktop/web2py/applications/turtlesite/controllers/default.py", line 84, in image\n  File "/usr/lib/python2.6/bdb.py", line 46, in trace_dispatch\n    return self.dispatch_line(frame)\n  File "/usr/lib/python2.6/bdb.py", line 65, in dispatch_line\n    if self.quitting: raise BdbQuit\nBdbQuit\n'
p8
s.