forked from jonoxia/platform-game
-
Notifications
You must be signed in to change notification settings - Fork 1
/
play.py
executable file
·35 lines (30 loc) · 970 Bytes
/
play.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
#!/usr/bin/python
from database_tables import Level
from webserver_utils import *
import cgi
import cgitb
import datetime
import simplejson
cgitb.enable()
q = cgi.FieldStorage()
player = verify_id()
levelName = q.getfirst("level", "")
data = {}
worldData = []
levels = Level.selectBy(name = levelName)
if levels.count() > 0:
level = levels[0]
if (level.creator == player):
editLink = "<a href=\"designer.html?level=%s\">Edit This Level</a>" % levelName
elif (level.creator != None):
editLink = "Created by %s." % level.creator.name
else:
editLink = ""
print "Content-type: text/html"
print
print render_template_file("play.html", {"playerName": player.name,
"avatarURL": player.avatarURL,
"levelName": levelName,
"editLink": editLink})
else:
print_redirect("listlevels.py")