entry: Add an initial Entry implementation
authorW. Trevor King <wking@tremily.us>
Sun, 30 Jun 2013 15:07:18 +0000 (11:07 -0400)
committerW. Trevor King <wking@tremily.us>
Sun, 30 Jun 2013 16:26:18 +0000 (12:26 -0400)
pycalendar/entry.py [new file with mode: 0644]

diff --git a/pycalendar/entry.py b/pycalendar/entry.py
new file mode 100644 (file)
index 0000000..692862a
--- /dev/null
@@ -0,0 +1,19 @@
+# Copyright
+
+class Entry (object):
+    """An iCalendar entry (e.g. VEVENT)
+    """
+    def __init__(self, type, content=None):
+        self.type = type
+        self.content = content
+
+    def __str__(self):
+        if self.content:
+            return self.content.replace('\r\n', '\n').strip()
+        return ''
+
+    def __repr__(self):
+        return '<{} type:{}>'.format(type(self).__name__, self.type)
+
+    def write(self, stream):
+        stream.write(self.content)