{"action":"created","comment":{"url":"https://api.github.com/repos/geier/khal/pulls/comments/34667126","id":34667126,"diff_hunk":"@@ -132,143 +208,124 @@ def symbol_strings(self):\n             )\n \n     @property\n-    def uid(self):\n-        return self.vevent['UID']\n+    def start_local(self):\n+        \"\"\"self.start() localized to local timezone\"\"\"\n+        return self.start\n \n     @property\n-    def ident(self):\n-        \"\"\"neeeded for vdirsyncer compat\"\"\"\n-        return self.vevent['UID']\n-\n-    @property\n-    def location(self):\n-        return self.vevent.get('LOCATION', None)\n-\n-    @property\n-    def description(self):\n-        return self.vevent.get('DESCRIPTION', None)\n+    def end_local(self):\n+        \"\"\"self.end() localized to local timezone\"\"\"\n+        return self.end\n \n     @property\n     def start(self):\n-        start = self.vevent['DTSTART'].dt\n-        if self.allday:\n-            return start\n-        if start.tzinfo is None:\n-            start = self.locale['local_timezone'].localize(start)\n-        start = start.astimezone(self.locale['local_timezone'])\n-        return start\n+        \"\"\"this should return the start date(time) as saved in the event\"\"\"\n+        return self._start\n \n     @property\n     def end(self):\n-        # TODO take care of events with neither DTEND nor DURATION\n+        \"\"\"this should return the end date(time) as saved in the event or\n+        implicitly defined by start and duration\"\"\"\n+        return self._end\n+\n+    @property\n+    def duration(self):\n         try:\n-            end = self.vevent['DTEND'].dt\n+            return self._vevents[self.ref]['DURATION'].dt\n         except KeyError:\n-            duration = self.vevent['DURATION']\n-            end = self.start + duration.dt\n-\n-        if self.allday:\n-            if end == self.start:\n-                # https://github.com/geier/khal/issues/129\n-                logger.warning('{} (\"{}\"): The event\\'s end date property '\n-                               'contains the same value as the start date, '\n-                               'which is invalid as per RFC 2445. Khal will '\n-                               'assume this is meant to be single-day event '\n-                               'on {}'.format(self.href, self.summary,\n-                                              self.start))\n-                end += timedelta(days=1)\n-            return end\n-\n-        if end.tzinfo is None:\n-            end = self.locale['default_timezone'].localize(end)\n-        end = end.astimezone(self.locale['local_timezone'])\n-        return end\n+            return self.end - self.start\n \n     @property\n-    def summary(self):\n-        return self.vevent['SUMMARY']\n+    def uid(self):\n+        return self._vevents[self.ref]['UID']\n \n     @property\n-    def recurpattern(self):\n-        if 'RRULE' in self.vevent:\n-            return self.vevent['RRULE'].to_ical()\n+    def organizer(self):\n+        if 'ORGANIZER' not in self._vevents[self.ref]:\n+            return ''\n+        organizer = self._vevents[self.ref]['ORGANIZER']\n+        cn = organizer.params.get('CN', '')\n+        email = organizer.split(':')[-1]\n+        if cn:\n+            return '{} ({})'.format(cn, email)\n         else:\n-            return None\n+            return email\n \n-    @property\n-    def recur(self):\n-        return 'RRULE' in self.vevent or 'RECURRENCE-ID' in self.vevent or \\\n-            'RDATE' in self.vevent\n+    @staticmethod\n+    def _create_calendar():\n+        \"\"\"\n+        create the calendar\n+\n+        :returns: calendar\n+        :rtype: icalendar.Calendar()\n+        \"\"\"\n+        calendar = icalendar.Calendar()\n+        calendar.add('version', '2.0')\n+        calendar.add('prodid', '-//CALENDARSERVER.ORG//NONSGML Version 1//EN')\n+        return calendar\n \n     @property\n     def raw(self):\n-        return self.to_ical().decode('utf-8')\n+        \"\"\"needed for vdirsyncer comat\n \n-    def to_ical(self):\n+        return text\n+        \"\"\"\n         calendar = self._create_calendar()\n-        if hasattr(self.vevent['DTSTART'].dt, 'tzinfo'):\n-            tzs = [self.start.tzinfo]\n-            if (\n-                'DTEND' in self.vevent and\n-                hasattr(self.vevent['DTEND'].dt, 'tzinfo') and\n-                (self.vevent['DTSTART'].dt.tzinfo !=\n-                 self.vevent['DTEND'].dt.tzinfo)\n-            ):\n-                tzs.append(self.vevent['DTEND'].dt.tzinfo)\n-\n-            for tzinfo in tzs:\n-                timezone = create_timezone(tzinfo, self.start)\n-                calendar.add_component(timezone)\n-\n-        calendar.add_component(self.vevent)\n-        return calendar.to_ical()\n-\n-    def long(self):\n-        \"\"\"complete description of this event in text form\n+        tzs = list()\n+        for vevent in self._vevents.values():\n+            if hasattr(vevent['DTSTART'].dt, 'tzinfo') and vevent['DTSTART'].dt.tzinfo is not None:\n+                tzs.append(vevent['DTSTART'].dt.tzinfo)\n+            if 'DTEND' in vevent and hasattr(vevent['DTEND'].dt, 'tzinfo') and \\\n+                    vevent['DTEND'].dt.tzinfo is not None and \\\n+                    vevent['DTEND'].dt.tzinfo not in tzs:\n+                tzs.append(vevent['DTEND'].dt.tzinfo)\n+\n+        for tzinfo in tzs:\n+            timezone = create_timezone(tzinfo, self.start)\n+            calendar.add_component(timezone)\n+\n+        for vevent in self._vevents.values():\n+            calendar.add_component(vevent)\n+        return calendar.to_ical().decode('utf-8')\n \n-        :rtype: str\n-        :returns: event description\n-        \"\"\"\n-        if self.allday:\n-            end = self.end - timedelta(days=1)\n-            if self.start == end:\n-                rangestr = self.start.strftime(self.locale['longdateformat'])\n-            else:\n-                if self.start.year == self.end.year:\n-                    startstr = self.start.strftime(self.locale['dateformat'])\n-                else:\n-                    startstr = self.start.strftime(self.locale['longdateformat'])\n-                endstr = end.strftime(self.locale['longdateformat'])\n-                rangestr = startstr + ' - ' + endstr\n-        else:\n-            # same day\n-            if self.start.utctimetuple()[:3] == self.end.utctimetuple()[:3]:\n-                starttime = self.start.strftime(self.locale['timeformat'])\n-                endtime = self.end.strftime(self.locale['timeformat'])\n-                datestr = self.end.strftime(self.locale['longdateformat'])\n-                rangestr = starttime + '-' + endtime + ' ' + datestr\n-            else:\n-                startstr = self.start.strftime(self.locale['longdatetimeformat'])\n-                endstr = self.end.strftime(self.locale['longdatetimeformat'])\n-                rangestr = startstr + ' - ' + endstr\n-            if self.start.tzinfo.zone != self.locale['local_timezone'].zone:\n-                # doesn't work yet\n-                # TODO FIXME\n-                pass\n-\n-        location = '\\nLocation: ' + self.location if \\\n-            self.location is not None else ''\n-        description = '\\nDescription: ' + self.description if \\\n-            self.description is not None else ''\n-        repitition = '\\nRepeat: ' + to_unicode(self.recurpattern) if \\\n-            self.recurpattern is not None else ''\n+    @property\n+    def ident(self):\n+        \"\"\"neeeded for vdirsyncer compat\"\"\"\n+        return self._vevents[self.ref]['UID']\n \n-        return '{}: {}{}{}{}'.format(\n-            rangestr, self.summary, location, repitition, description)\n+    @property\n+    def summary(self):\n+        return self._vevents[self.ref].get('SUMMARY', '')\n+\n+    def update_summary(self, summary):","path":"khal/khalendar/event.py","position":450,"original_position":450,"commit_id":"ffde125d42a7c9baabb59ab5879efa2a86bbfcd7","original_commit_id":"ffde125d42a7c9baabb59ab5879efa2a86bbfcd7","user":{"login":"geier","id":275330,"avatar_url":"https://avatars.githubusercontent.com/u/275330?v=3","gravatar_id":"","url":"https://api.github.com/users/geier","html_url":"https://github.com/geier","followers_url":"https://api.github.com/users/geier/followers","following_url":"https://api.github.com/users/geier/following{/other_user}","gists_url":"https://api.github.com/users/geier/gists{/gist_id}","starred_url":"https://api.github.com/users/geier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/geier/subscriptions","organizations_url":"https://api.github.com/users/geier/orgs","repos_url":"https://api.github.com/users/geier/repos","events_url":"https://api.github.com/users/geier/events{/privacy}","received_events_url":"https://api.github.com/users/geier/received_events","type":"User","site_admin":false},"body":"Yes, an Event represents only one specific recurrence instance and all recurrence instances of the same proto Event have the same self._vevents (but not the identical object). I don't believe that with the current functionality of khal we really need to access other recurrence instances properties (if they are deviating).","created_at":"2015-07-15T10:53:59Z","updated_at":"2015-07-15T10:53:59Z","html_url":"https://github.com/geier/khal/pull/223#discussion_r34667126","pull_request_url":"https://api.github.com/repos/geier/khal/pulls/223","_links":{"self":{"href":"https://api.github.com/repos/geier/khal/pulls/comments/34667126"},"html":{"href":"https://github.com/geier/khal/pull/223#discussion_r34667126"},"pull_request":{"href":"https://api.github.com/repos/geier/khal/pulls/223"}}},"pull_request":{"url":"https://api.github.com/repos/geier/khal/pulls/223","id":39974215,"html_url":"https://github.com/geier/khal/pull/223","diff_url":"https://github.com/geier/khal/pull/223.diff","patch_url":"https://github.com/geier/khal/pull/223.patch","issue_url":"https://api.github.com/repos/geier/khal/issues/223","number":223,"state":"open","locked":false,"title":"[Please Test] rewrite of the event class and the database","user":{"login":"geier","id":275330,"avatar_url":"https://avatars.githubusercontent.com/u/275330?v=3","gravatar_id":"","url":"https://api.github.com/users/geier","html_url":"https://github.com/geier","followers_url":"https://api.github.com/users/geier/followers","following_url":"https://api.github.com/users/geier/following{/other_user}","gists_url":"https://api.github.com/users/geier/gists{/gist_id}","starred_url":"https://api.github.com/users/geier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/geier/subscriptions","organizations_url":"https://api.github.com/users/geier/orgs","repos_url":"https://api.github.com/users/geier/repos","events_url":"https://api.github.com/users/geier/events{/privacy}","received_events_url":"https://api.github.com/users/geier/received_events","type":"User","site_admin":false},"body":"this should fix some issues (like #222 and #195) and enable the deletion and modification of single instances of recurring events (not implemented yet). \r\n\r\nand yes, I know some tests are failling.\r\n\r\n * [ ] enable simple sorting of events\r\n * [ ] print warning when using default_timezone\r\n * [ ] re-fix RRULE editor","created_at":"2015-07-14T23:27:16Z","updated_at":"2015-07-15T10:53:59Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f210a29987adbc6028e1dc260c9e37bbff60d8a6","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/geier/khal/pulls/223/commits","review_comments_url":"https://api.github.com/repos/geier/khal/pulls/223/comments","review_comment_url":"https://api.github.com/repos/geier/khal/pulls/comments{/number}","comments_url":"https://api.github.com/repos/geier/khal/issues/223/comments","statuses_url":"https://api.github.com/repos/geier/khal/statuses/ffde125d42a7c9baabb59ab5879efa2a86bbfcd7","head":{"label":"geier:event_rewrite","ref":"event_rewrite","sha":"ffde125d42a7c9baabb59ab5879efa2a86bbfcd7","user":{"login":"geier","id":275330,"avatar_url":"https://avatars.githubusercontent.com/u/275330?v=3","gravatar_id":"","url":"https://api.github.com/users/geier","html_url":"https://github.com/geier","followers_url":"https://api.github.com/users/geier/followers","following_url":"https://api.github.com/users/geier/following{/other_user}","gists_url":"https://api.github.com/users/geier/gists{/gist_id}","starred_url":"https://api.github.com/users/geier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/geier/subscriptions","organizations_url":"https://api.github.com/users/geier/orgs","repos_url":"https://api.github.com/users/geier/repos","events_url":"https://api.github.com/users/geier/events{/privacy}","received_events_url":"https://api.github.com/users/geier/received_events","type":"User","site_admin":false},"repo":{"id":12357974,"name":"khal","full_name":"geier/khal","owner":{"login":"geier","id":275330,"avatar_url":"https://avatars.githubusercontent.com/u/275330?v=3","gravatar_id":"","url":"https://api.github.com/users/geier","html_url":"https://github.com/geier","followers_url":"https://api.github.com/users/geier/followers","following_url":"https://api.github.com/users/geier/following{/other_user}","gists_url":"https://api.github.com/users/geier/gists{/gist_id}","starred_url":"https://api.github.com/users/geier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/geier/subscriptions","organizations_url":"https://api.github.com/users/geier/orgs","repos_url":"https://api.github.com/users/geier/repos","events_url":"https://api.github.com/users/geier/events{/privacy}","received_events_url":"https://api.github.com/users/geier/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/geier/khal","description":"CLI calendar application","fork":false,"url":"https://api.github.com/repos/geier/khal","forks_url":"https://api.github.com/repos/geier/khal/forks","keys_url":"https://api.github.com/repos/geier/khal/keys{/key_id}","collaborators_url":"https://api.github.com/repos/geier/khal/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/geier/khal/teams","hooks_url":"https://api.github.com/repos/geier/khal/hooks","issue_events_url":"https://api.github.com/repos/geier/khal/issues/events{/number}","events_url":"https://api.github.com/repos/geier/khal/events","assignees_url":"https://api.github.com/repos/geier/khal/assignees{/user}","branches_url":"https://api.github.com/repos/geier/khal/branches{/branch}","tags_url":"https://api.github.com/repos/geier/khal/tags","blobs_url":"https://api.github.com/repos/geier/khal/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/geier/khal/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/geier/khal/git/refs{/sha}","trees_url":"https://api.github.com/repos/geier/khal/git/trees{/sha}","statuses_url":"https://api.github.com/repos/geier/khal/statuses/{sha}","languages_url":"https://api.github.com/repos/geier/khal/languages","stargazers_url":"https://api.github.com/repos/geier/khal/stargazers","contributors_url":"https://api.github.com/repos/geier/khal/contributors","subscribers_url":"https://api.github.com/repos/geier/khal/subscribers","subscription_url":"https://api.github.com/repos/geier/khal/subscription","commits_url":"https://api.github.com/repos/geier/khal/commits{/sha}","git_commits_url":"https://api.github.com/repos/geier/khal/git/commits{/sha}","comments_url":"https://api.github.com/repos/geier/khal/comments{/number}","issue_comment_url":"https://api.github.com/repos/geier/khal/issues/comments{/number}","contents_url":"https://api.github.com/repos/geier/khal/contents/{+path}","compare_url":"https://api.github.com/repos/geier/khal/compare/{base}...{head}","merges_url":"https://api.github.com/repos/geier/khal/merges","archive_url":"https://api.github.com/repos/geier/khal/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/geier/khal/downloads","issues_url":"https://api.github.com/repos/geier/khal/issues{/number}","pulls_url":"https://api.github.com/repos/geier/khal/pulls{/number}","milestones_url":"https://api.github.com/repos/geier/khal/milestones{/number}","notifications_url":"https://api.github.com/repos/geier/khal/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/geier/khal/labels{/name}","releases_url":"https://api.github.com/repos/geier/khal/releases{/id}","created_at":"2013-08-25T11:22:27Z","updated_at":"2015-07-14T23:39:00Z","pushed_at":"2015-07-14T23:40:46Z","git_url":"git://github.com/geier/khal.git","ssh_url":"git@github.com:geier/khal.git","clone_url":"https://github.com/geier/khal.git","svn_url":"https://github.com/geier/khal","homepage":"http://lostpackets.de/khal/","size":3406,"stargazers_count":354,"watchers_count":354,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":34,"mirror_url":null,"open_issues_count":34,"forks":34,"open_issues":34,"watchers":354,"default_branch":"master"}},"base":{"label":"geier:master","ref":"master","sha":"228e07c6c6a744ee3aa749d6cd87e9a67e40604c","user":{"login":"geier","id":275330,"avatar_url":"https://avatars.githubusercontent.com/u/275330?v=3","gravatar_id":"","url":"https://api.github.com/users/geier","html_url":"https://github.com/geier","followers_url":"https://api.github.com/users/geier/followers","following_url":"https://api.github.com/users/geier/following{/other_user}","gists_url":"https://api.github.com/users/geier/gists{/gist_id}","starred_url":"https://api.github.com/users/geier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/geier/subscriptions","organizations_url":"https://api.github.com/users/geier/orgs","repos_url":"https://api.github.com/users/geier/repos","events_url":"https://api.github.com/users/geier/events{/privacy}","received_events_url":"https://api.github.com/users/geier/received_events","type":"User","site_admin":false},"repo":{"id":12357974,"name":"khal","full_name":"geier/khal","owner":{"login":"geier","id":275330,"avatar_url":"https://avatars.githubusercontent.com/u/275330?v=3","gravatar_id":"","url":"https://api.github.com/users/geier","html_url":"https://github.com/geier","followers_url":"https://api.github.com/users/geier/followers","following_url":"https://api.github.com/users/geier/following{/other_user}","gists_url":"https://api.github.com/users/geier/gists{/gist_id}","starred_url":"https://api.github.com/users/geier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/geier/subscriptions","organizations_url":"https://api.github.com/users/geier/orgs","repos_url":"https://api.github.com/users/geier/repos","events_url":"https://api.github.com/users/geier/events{/privacy}","received_events_url":"https://api.github.com/users/geier/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/geier/khal","description":"CLI calendar application","fork":false,"url":"https://api.github.com/repos/geier/khal","forks_url":"https://api.github.com/repos/geier/khal/forks","keys_url":"https://api.github.com/repos/geier/khal/keys{/key_id}","collaborators_url":"https://api.github.com/repos/geier/khal/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/geier/khal/teams","hooks_url":"https://api.github.com/repos/geier/khal/hooks","issue_events_url":"https://api.github.com/repos/geier/khal/issues/events{/number}","events_url":"https://api.github.com/repos/geier/khal/events","assignees_url":"https://api.github.com/repos/geier/khal/assignees{/user}","branches_url":"https://api.github.com/repos/geier/khal/branches{/branch}","tags_url":"https://api.github.com/repos/geier/khal/tags","blobs_url":"https://api.github.com/repos/geier/khal/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/geier/khal/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/geier/khal/git/refs{/sha}","trees_url":"https://api.github.com/repos/geier/khal/git/trees{/sha}","statuses_url":"https://api.github.com/repos/geier/khal/statuses/{sha}","languages_url":"https://api.github.com/repos/geier/khal/languages","stargazers_url":"https://api.github.com/repos/geier/khal/stargazers","contributors_url":"https://api.github.com/repos/geier/khal/contributors","subscribers_url":"https://api.github.com/repos/geier/khal/subscribers","subscription_url":"https://api.github.com/repos/geier/khal/subscription","commits_url":"https://api.github.com/repos/geier/khal/commits{/sha}","git_commits_url":"https://api.github.com/repos/geier/khal/git/commits{/sha}","comments_url":"https://api.github.com/repos/geier/khal/comments{/number}","issue_comment_url":"https://api.github.com/repos/geier/khal/issues/comments{/number}","contents_url":"https://api.github.com/repos/geier/khal/contents/{+path}","compare_url":"https://api.github.com/repos/geier/khal/compare/{base}...{head}","merges_url":"https://api.github.com/repos/geier/khal/merges","archive_url":"https://api.github.com/repos/geier/khal/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/geier/khal/downloads","issues_url":"https://api.github.com/repos/geier/khal/issues{/number}","pulls_url":"https://api.github.com/repos/geier/khal/pulls{/number}","milestones_url":"https://api.github.com/repos/geier/khal/milestones{/number}","notifications_url":"https://api.github.com/repos/geier/khal/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/geier/khal/labels{/name}","releases_url":"https://api.github.com/repos/geier/khal/releases{/id}","created_at":"2013-08-25T11:22:27Z","updated_at":"2015-07-14T23:39:00Z","pushed_at":"2015-07-14T23:40:46Z","git_url":"git://github.com/geier/khal.git","ssh_url":"git@github.com:geier/khal.git","clone_url":"https://github.com/geier/khal.git","svn_url":"https://github.com/geier/khal","homepage":"http://lostpackets.de/khal/","size":3406,"stargazers_count":354,"watchers_count":354,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":34,"mirror_url":null,"open_issues_count":34,"forks":34,"open_issues":34,"watchers":354,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/geier/khal/pulls/223"},"html":{"href":"https://github.com/geier/khal/pull/223"},"issue":{"href":"https://api.github.com/repos/geier/khal/issues/223"},"comments":{"href":"https://api.github.com/repos/geier/khal/issues/223/comments"},"review_comments":{"href":"https://api.github.com/repos/geier/khal/pulls/223/comments"},"review_comment":{"href":"https://api.github.com/repos/geier/khal/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/geier/khal/pulls/223/commits"},"statuses":{"href":"https://api.github.com/repos/geier/khal/statuses/ffde125d42a7c9baabb59ab5879efa2a86bbfcd7"}}}}