Permalink
Browse files

Mostly added untested WIND support

  • Loading branch information...
1 parent f67d10d commit 5d924a50d46b9985d1e221ffec8a3069ffb37945 @thenoviceoof committed Nov 27, 2011
Showing with 592 additions and 3 deletions.
  1. +7 −0 README.md
  2. +45 −0 WIND_auth.py
  3. +3 −0 app.yaml
  4. +8 −0 appengine_config.py
  5. +13 −2 flyer.py
  6. +515 −0 gaesessions/__init__.py
  7. +1 −1 lib.py
View
@@ -20,6 +20,13 @@ TODO
INSTALL
================================================================================
+ *
+ * you'll need to make your own auth endpoint
USAGE
================================================================================
+ * ?
+
+ACK
+================================================================================
+ * gae-sessions <https://github.com/dound/gae-sessions>
View
@@ -0,0 +1,45 @@
+from google.appengine.ext import db
+from google.appengine.ext import webapp
+from google.appengine.ext.webapp import template
+from google.appengine.ext.webapp.util import run_wsgi_app
+
+from models import Token2Club
+from lib import BaseHandler
+import logging
+import urllib, urllib2
+
+from gaesessions import get_current_session
+
+from google.appengine.dist import use_library
+use_library('django', '0.96')
+
+def WINDCallback(BaseHandler):
+ def get(self):
+ token = self.request.get("token")
+ url = "https://wind.columbia.edu/validate?ticketid={0}".format(token)
+ r = urllib2.Request(url=url)
+ lines = urllib2.urlopen(r).split("\n")
+ if lines[0] == "yes":
+ ident = lines[1]
+
+ # make sure we have a mapping
+ token_user = Token2Club.get_or_insert(ident)
+ token_user.token = ident
+ token_user.put()
+ # and set the session cookie
+ session = get_current_sesssion()
+ if session.is_active():
+ session["user"] = indent
+ session.regenerate_id()
+ self.redirect("/")
+
+application = webapp.WSGIApplication(
+ [('/callback', Index),
+ ],
+ debug=True)
+
+def main():
+ run_wsgi_app(application)
+
+if __name__ == "__main__":
+ main()
View
@@ -11,5 +11,8 @@ handlers:
- url: /static
static_dir: static
+- url: /callback
+ script: WIND_auth.py
+
- url: /.*
script: flyer.py
View
@@ -0,0 +1,8 @@
+from gaesessions import SessionMiddleware
+import datetime
+
+def webapp_add_wsgi_middleware(app):
+ app = SessionMiddleware(app,
+ cookie_key="d41d8cd98f00b204e9800998ecf8427e",
+ lifetime=datetime.timedelta(hours=1))
+ return app
View
@@ -15,15 +15,25 @@ class Index(BaseHandler):
def get(self):
# ??? find some way to pull this out to a settings file?
values = {"affiliation":"Columbia University"}
+ # redirect to
self.response.out.write(template.render("templates/index.html", values))
+# choose which organization to flyer for
+class Org(BaseHandler):
+ def get(self):
+ values = {}
+ self.response.out.write(template.render("templates/upload.html", values))
+
+# upload page
+# !!! no reason this has to be post
class Prep(BaseHandler):
def get(self):
self.post()
def post(self):
values = {}
self.response.out.write(template.render("templates/upload.html", values))
+# upload handler
class Upload(BaseHandler):
def post(self):
flyer = Flyer()
@@ -88,9 +98,10 @@ def get(self, flyer_id, email):
# !!! stop has to handle /stop/email/club, /stop/email
# !!! check email.html
class Stop(BaseHandler):
- def get(self, email):
+ def get(self, email_id):
+ email = Email.get(email_id)
q = Job.all()
- q.filter("email =", urllib.unquote(email))
+ q.filter("email =", email)
jobs = q.fetch(BOUND)
for job in jobs:
job.delete()
Oops, something went wrong.

0 comments on commit 5d924a5

Please sign in to comment.