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
Comment cleaup, added function
[frenchie/icalparse.git]
/
icalparse.py
diff --git
a/icalparse.py
b/icalparse.py
index
3b9091a
..
5010d1d
100755
(executable)
--- a/
icalparse.py
+++ b/
icalparse.py
@@
-28,8
+28,6
@@
import os
class InvalidICS(Exception): pass
class notJoined(Exception): pass
class InvalidICS(Exception): pass
class notJoined(Exception): pass
-# RFC5545 and RFC5546 iCalendar registries contain upper case letters
-# and dashes only and are separated from the value by a colon (:)
icalEntry = re.compile('^[A-Z\-]+:.*')
def lineJoiner(oldcal):
icalEntry = re.compile('^[A-Z\-]+:.*')
def lineJoiner(oldcal):
@@
-38,8
+36,6
@@
def lineJoiner(oldcal):
if list(oldcal) == oldcal:
oldcal = '\r\n'.join(oldcal)
if list(oldcal) == oldcal:
oldcal = '\r\n'.join(oldcal)
- # RFC2445 This sequence defines a content 'fold' and needs to be stripped
- # from the output before writing the file
oldcal.replace('\r\n ', '')
return oldcal.split('\r\n')
oldcal.replace('\r\n ', '')
return oldcal.split('\r\n')
@@
-47,11
+43,14
@@
def lineJoiner(oldcal):
def lineFolder(oldcal, length=75):
'''Folds content lines to a specified length, returns a list'''
def lineFolder(oldcal, length=75):
'''Folds content lines to a specified length, returns a list'''
+ if length > 75:
+ sys.stderr.write('WARN: lines > 75 octets are not RFC compliant\n')
+
cal = []
sl = length - 1
for line in oldcal:
cal = []
sl = length - 1
for line in oldcal:
- # Line
& line ending line ending fit
inside length, do nothing
+ # Line
fits
inside length, do nothing
if len(line.rstrip()) <= length:
cal.append(line)
else:
if len(line.rstrip()) <= length:
cal.append(line)
else:
@@
-64,6
+63,10
@@
def lineFolder(oldcal, length=75):
return cal
return cal
+def getContent(url='',stdin=False):
+ pass
+
+
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,
@@
-125,9
+128,3
@@
if __name__ == '__main__':
if options.stdin:
content = sys.stdin.read()
if options.stdin:
content = sys.stdin.read()
-
- # RFC5545 and RFC5546 New calendars should be generated UTF-8 and we need to
- # be able to read ANSI as well. This should take care of us.
- content = unicode(content, encoding='utf-8')
-
- #return content
UCC
git Repository :: git.ucc.asn.au