def runCGI():
- '''Main run function if this script is called as a CGI script'''
+ '''Main run function if this script is called as a CGI script
+ to process facebook ical files'''
import cgi
import re
import cgitb; cgitb.enable()
+ ruleConfig["facebook"] = True
+
form = cgi.FieldStorage()
if "uid" not in form or "key" not in form:
print('Content-Type: text/calendar\n')
cal = applyRules(cal, generateRules(ruleConfig), False)
print('Content-Type: text/calendar; charset=%s\n'%encoding)
- icalparse.writeOutput(cal)
+ writeOutput(cal)
if __name__ == '__main__':
def dropAttributes(cal):
'''Removing unwanted metadata'''
+ if "facebook" in ruleConfig:
+ if ruleConfig["facebook"] == True: return cal
eventBlacklist = [x.lower() for x in [
"X-ALT-DESC",
def exDate(cal):
'''Replacing multi-value EXDATES with multiple single-value EXDATES'''
+ if "facebook" in ruleConfig:
+ if ruleConfig["facebook"] == True: return cal
from datetime import datetime
from pytz import timezone