From: James French Date: Mon, 4 Mar 2013 14:42:58 +0000 (+0800) Subject: Disable Outlook Rules for Facebook X-Git-Tag: 1.0~2 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=a60d888467b796bdf7ed7cd63c53cef8dcfc779c;p=frenchie%2Ficalparse.git Disable Outlook Rules for Facebook - Bugfixes as a bonus --- diff --git a/icalparse.py b/icalparse.py index 4dd1229..1d62a70 100755 --- a/icalparse.py +++ b/icalparse.py @@ -206,11 +206,14 @@ def exitQuiet(exitstate=0): 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') @@ -248,7 +251,7 @@ def runCGI(): cal = applyRules(cal, generateRules(ruleConfig), False) print('Content-Type: text/calendar; charset=%s\n'%encoding) - icalparse.writeOutput(cal) + writeOutput(cal) if __name__ == '__main__': diff --git a/parserrules.py b/parserrules.py index 4bb0dd5..4ba71e8 100644 --- a/parserrules.py +++ b/parserrules.py @@ -62,6 +62,8 @@ def whatPrivacy(cal): 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", @@ -103,6 +105,8 @@ def dropAttributes(cal): 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