Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/controllers/default.py.1
blob: dd1034741cd37a5fd9e0ced0154a93f1cbe54f00 (plain)
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
import os

def index():
    if len(request.args):
      records = db(db.comment.image_id==request.args[0]).select()
    if len(request.args) and len(records):
      form = SQLFORM(db.comment, records[0], deletable=True)
    else:
      form = SQLFORM(db.comment, fields = ['title', 'file', 'creator', 'description'])
    if form.accepts(request.vars, session):
      response.flash = 'form accepted'
      session.file = form.vars.file
      redirect(URL(r=request, f='jamiesprogram')) 
    elif form.errors:
      response.flash = 'form has errors'
    return dict(form=form)

def jamiesprogram():
    images = db().select(db.comment.ALL)
    for row in images:
      db.comment.insert(file=os.system('python applications/turtle_art_images/modules/PngGenerator.py '+URL(request.application,'default','download',args=row.file)))
    return dict()
  
def imagelist():
  comments = db().select(db.comment.ALL)
  return dict(comments=comments)
  
def adminpage():
  db.comment.truncate()
  redirect('index.html')

def imagetemplate():
  return dict()
  
def download():
  return response.download(request, db)