From 024f6e82e68b9e862387ec541dd4ab4328d9df9c Mon Sep 17 00:00:00 2001 From: 藍挺瑋 Date: Fri, 21 Dec 2012 09:52:09 +0800 Subject: NTU CEIBA 解析支援,但網頁部份尚未實作(仍在測試中,可能修改 API) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 繳交日期之後會改成字串,因為其實只有期限比較重要而已...... --- access/imnc.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 access/imnc.py (limited to 'access/imnc.py') diff --git a/access/imnc.py b/access/imnc.py new file mode 100644 index 0000000..2451bd7 --- /dev/null +++ b/access/imnc.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python +# -*- coding: UTF-8 -*- + +import webapp2 +from StringIO import StringIO + +from ntuceiba import NtuCeibaEvent +from ntuceiba.parse import ntuceiba_parser +from ntuceiba.toxml import ntuceiba_toxml + +from google.appengine.api import users +from google.appengine.ext import db + +class NtuCeibaImport(webapp2.RedirectHandler): + def get(self): + return + def post(self): + viewonly = self.request.get('viewonly') + htmlfile = self.request.get('file') + if viewonly != "": + htmlfile = StringIO(htmlfile) + htmlfile.readline() + cblist = ntuceiba_parser(htmlfile) + self.response.headers['Content-Type'] = 'text/xml; charset=UTF-8' + self.response.out.write(ntuceiba_toxml(cblist)) + + +app = webapp2.WSGIApplication([('/access/imnc', NtuCeibaImport)]) -- cgit