Skip to content

Instantly share code, notes, and snippets.

@tkf
Created November 12, 2009 07:13
Show Gist options
  • Save tkf/232680 to your computer and use it in GitHub Desktop.
Save tkf/232680 to your computer and use it in GitHub Desktop.
# -*- coding: utf-8 -*-
import os
import cgi
## import cgitb
## cgitb.enable()
caldir_path = "../path/to/cal/"
calset = set(['cal1','cal2','cal3',])
fs = cgi.FieldStorage()
cal = fs.getvalue('cal')
cal_path = os.path.join(caldir_path, cal + '.ics')
ctype = fs.getvalue('ctype')
if ctype == "plain":
print "Content-Type: text/plain\n"
elif ctype == "html":
print "Content-Type: text/html\n"
else:
print "Content-Type: text/calendar; charset=utf-8\n"
if cal in calset:
print file(cal_path).read()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment