X-Git-Url: https://git.ucc.asn.au/?p=frenchie%2Ficalparse.git;a=blobdiff_plain;f=icalparse.py;h=1ed6076da0d36257c62abf5a12294b0cec95fbc6;hp=a492dfa34bbfa49a18eb2d9c9d32aef951e0deb7;hb=48d87039714129b0798a4efba2938d15190af7d8;hpb=b0a19e2cc2a8c71e095024b5771880b9b7424da6 diff --git a/icalparse.py b/icalparse.py index a492dfa..1ed6076 100755 --- a/icalparse.py +++ b/icalparse.py @@ -150,6 +150,18 @@ def getHTTPContent(url='',cache='.httplib2-cache'): return '' + +def generateRules(): + '''Attempts to load a series of rules into a list''' + try: + import parserrules + except ImportError: + return [] + + rules = [getattr(parserrules, rule) for rule in dir(parserrules) if callable(getattr(parserrules, rule))] + return rules + + if __name__ == '__main__': from optparse import OptionParser # If the user passed us a 'stdin' argument, we'll go with that, @@ -174,4 +186,5 @@ if __name__ == '__main__': content = getContent(url, options.stdin) cal = lineJoiner(content) ical = splitFields(cal) - print ical + rules = generateRules() + print rules