Permalink
Browse files

Specify the current season in the app config

This goes into the filenames in downloaded replays.
  • Loading branch information...
1 parent 0e20f8d commit 2d7ecfcca9a4f25cfc6f6c19bb3f28d318fedadb @dreiss committed Feb 6, 2012
Showing with 13 additions and 7 deletions.
  1. +10 −6 ahgl_admin.py
  2. +1 −0 debug_server.py
  3. +2 −1 webdriver_tests.py
View
@@ -506,12 +506,16 @@ def cleanit(word):
<title>AHGL Result</title>
</head>
<body>
- <h1>AHGL Result Week %d</h1>
- <p><a href="/replay-pack/%d/ahgl_replays_week_%d.zip">Replay Pack</a></p>
- %s
+ <h1>AHGL Result Week %(week)d</h1>
+ <p><a href="/replay-pack/%(week)d/ahgl_replays_season_%(season)s_week_%(week)d.zip">Replay Pack</a></p>
+ %(display)s
</body>
</html>
- """ % (week, week, week, "".join(result_displays))).encode()])
+ """ % dict(
+ week = week,
+ season = app.config["SEASON"],
+ display = "".join(result_displays),
+ )).encode()])
@app.route("/enter-result")
@@ -760,8 +764,8 @@ def cleanit(word):
return re.sub("[^a-zA-Z0-9]", "", word)
zfile.write(
os.path.join(app.config["DATA_DIR"], replayhash + ".SC2Replay"),
- "AHGLpre_Week-%d/Match-%d_%s-%s/%s-%s_%d_%s-%s.SC2Replay" % (
- week, match, cleanit(teams[hteam]), cleanit(teams[ateam]), cleanit(teams[hteam]), cleanit(teams[ateam]), setnum, cleanit(hplayer), cleanit(aplayer)))
+ "AHGL_S%s_Week-%d/Match-%d_%s-%s/%s-%s_%d_%s-%s.SC2Replay" % (
+ app.config["SEASON"], week, match, cleanit(teams[hteam]), cleanit(teams[ateam]), cleanit(teams[hteam]), cleanit(teams[ateam]), setnum, cleanit(hplayer), cleanit(aplayer)))
zfile.close()
View
@@ -2,6 +2,7 @@
import ahgl_admin
DATA_DIR = './data'
+SEASON = '2'
if __name__ == '__main__':
ahgl_admin.app.config.from_object(__name__)
View
@@ -39,6 +39,7 @@ def setUp(self):
self.data_dir = tempfile.mkdtemp()
ahgl_admin.app.debug = True # TODO: drop
ahgl_admin.app.config['DATA_DIR'] = self.data_dir
+ ahgl_admin.app.config['SEASON'] = '2'
ahgl_admin.app.secret_key = 'AHGL'
self.httpd = wsgiref.simple_server.make_server('', 0, ahgl_admin.app.wsgi_app)
self.base_url = 'http://localhost:%d/' % self.httpd.server_address[1]
@@ -281,7 +282,7 @@ def enter_lineup(week, team, players, ref):
with contextlib.closing(urllib2.urlopen(replay_pack_link)) as handle:
replay_pack = handle.read()
zfile = zipfile.ZipFile(cStringIO.StringIO(replay_pack))
- with contextlib.closing(zfile.open('AHGLpre_Week-1/Match-1_Twitter-Zynga/Twitter-Zynga_1_implausible-ShamWOW.SC2Replay')) as handle:
+ with contextlib.closing(zfile.open('AHGL_S2_Week-1/Match-1_Twitter-Zynga/Twitter-Zynga_1_implausible-ShamWOW.SC2Replay')) as handle:
self.assertEqual(hashlib.sha1(handle.read()).hexdigest(), TEST_REPLAY_SHA1)
wd.get(bu)

0 comments on commit 2d7ecfc

Please sign in to comment.