git.ucc.asn.au
/
frenchie
/
icalparse.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Loads rules from a source file
[frenchie/icalparse.git]
/
icalparse.py
diff --git
a/icalparse.py
b/icalparse.py
index
a492dfa
..
1ed6076
100755
(executable)
--- a/
icalparse.py
+++ b/
icalparse.py
@@
-150,6
+150,18
@@
def getHTTPContent(url='',cache='.httplib2-cache'):
return ''
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,
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)
content = getContent(url, options.stdin)
cal = lineJoiner(content)
ical = splitFields(cal)
- print ical
+ rules = generateRules()
+ print rules
UCC
git Repository :: git.ucc.asn.au