<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[14301] PyCalendar/trunk/src/pycalendar</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.calendarserver.org//changeset/14301">14301</a></dd>
<dt>Author</dt> <dd>cdaboo@apple.com</dd>
<dt>Date</dt> <dd>2015-01-14 07:39:56 -0800 (Wed, 14 Jan 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Update to latest VPOLL spec.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#PyCalendartrunksrcpycalendar__init__py">PyCalendar/trunk/src/pycalendar/__init__.py</a></li>
<li><a href="#PyCalendartrunksrcpycalendaricalendardefinitionspy">PyCalendar/trunk/src/pycalendar/icalendar/definitions.py</a></li>
<li><a href="#PyCalendartrunksrcpycalendaricalendarpropertypy">PyCalendar/trunk/src/pycalendar/icalendar/property.py</a></li>
<li><a href="#PyCalendartrunksrcpycalendaricalendarteststest_vpollpy">PyCalendar/trunk/src/pycalendar/icalendar/tests/test_vpoll.py</a></li>
<li><a href="#PyCalendartrunksrcpycalendaricalendarvpollpy">PyCalendar/trunk/src/pycalendar/icalendar/vpoll.py</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#PyCalendartrunksrcpycalendaricalendarvotepy">PyCalendar/trunk/src/pycalendar/icalendar/vote.py</a></li>
<li><a href="#PyCalendartrunksrcpycalendaricalendarvvoterpy">PyCalendar/trunk/src/pycalendar/icalendar/vvoter.py</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="PyCalendartrunksrcpycalendar__init__py"></a>
<div class="modfile"><h4>Modified: PyCalendar/trunk/src/pycalendar/__init__.py (14300 => 14301)</h4>
<pre class="diff"><span>
<span class="info">--- PyCalendar/trunk/src/pycalendar/__init__.py        2015-01-14 15:38:08 UTC (rev 14300)
+++ PyCalendar/trunk/src/pycalendar/__init__.py        2015-01-14 15:39:56 UTC (rev 14301)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> ##
</span><del>-# Copyright (c) 2007-2013 Cyrus Daboo. All rights reserved.
</del><ins>+# Copyright (c) 2007-2015 Cyrus Daboo. All rights reserved.
</ins><span class="cx"> #
</span><span class="cx"> # Licensed under the Apache License, Version 2.0 (the "License");
</span><span class="cx"> # you may not use this file except in compliance with the License.
</span><span class="lines">@@ -44,8 +44,10 @@
</span><span class="cx"> import icalendar.vfreebusy
</span><span class="cx"> import icalendar.vjournal
</span><span class="cx"> import icalendar.vpoll
</span><ins>+import icalendar.vote
</ins><span class="cx"> import icalendar.vtimezone
</span><span class="cx"> import icalendar.vtimezonedaylight
</span><span class="cx"> import icalendar.vtimezonestandard
</span><span class="cx"> import icalendar.vtodo
</span><span class="cx"> import icalendar.vunknown
</span><ins>+import icalendar.vvoter
</ins></span></pre></div>
<a id="PyCalendartrunksrcpycalendaricalendardefinitionspy"></a>
<div class="modfile"><h4>Modified: PyCalendar/trunk/src/pycalendar/icalendar/definitions.py (14300 => 14301)</h4>
<pre class="diff"><span>
<span class="info">--- PyCalendar/trunk/src/pycalendar/icalendar/definitions.py        2015-01-14 15:38:08 UTC (rev 14300)
+++ PyCalendar/trunk/src/pycalendar/icalendar/definitions.py        2015-01-14 15:39:56 UTC (rev 14301)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> ##
</span><del>-# Copyright (c) 2007-2013 Cyrus Daboo. All rights reserved.
</del><ins>+# Copyright (c) 2007-2015 Cyrus Daboo. All rights reserved.
</ins><span class="cx"> #
</span><span class="cx"> # Licensed under the Apache License, Version 2.0 (the "License");
</span><span class="cx"> # you may not use this file except in compliance with the License.
</span><span class="lines">@@ -334,24 +334,27 @@
</span><span class="cx"> cICalProperty_ACTION_NONE = "NONE"
</span><span class="cx">
</span><span class="cx">
</span><del>-# Extensions: draft-york-vpoll-00.txt
</del><ins>+# Extensions: draft-york-vpoll-03.txt
</ins><span class="cx">
</span><del>-# Section 4.1
-cICalParamater_PUBLIC_COMMENT = "PUBLIC-COMMENT"
-cICalParamater_RESPONSE = "RESPONSE"
</del><ins>+# Section 4.3
+cICalParamater_REQUIRED = "REQUIRED"
</ins><span class="cx"> cICalParamater_STAY_INFORMED = "STAY-INFORMED"
</span><span class="cx">
</span><del>-# Section 4.2
</del><ins>+# Section 4.4
</ins><span class="cx"> cICalProperty_ACCEPT_RESPONSE = "ACCEPT-RESPONSE"
</span><ins>+cICalProperty_POLL_COMPLETION = "POLL-COMPLETION"
</ins><span class="cx"> cICalProperty_POLL_ITEM_ID = "POLL-ITEM-ID"
</span><del>-cICalProperty_POLL_WINNER = "POLL-WINNER"
</del><span class="cx"> cICalProperty_POLL_MODE = "POLL-MODE"
</span><span class="cx"> cICalProperty_POLL_MODE_BASIC = "BASIC"
</span><span class="cx"> cICalProperty_POLL_PROPERTIES = "POLL-PROPERTIES"
</span><ins>+cICalProperty_POLL_WINNER = "POLL-WINNER"
+cICalProperty_RESPONSE = "RESPONSE"
</ins><span class="cx"> cICalProperty_VOTER = "VOTER"
</span><span class="cx">
</span><del>-# Section 4.3
</del><ins>+# Section 4.5
</ins><span class="cx"> cICalComponent_VPOLL = "VPOLL"
</span><ins>+cICalComponent_VVOTER = "VVOTER"
+cICalComponent_VOTE = "VOTE"
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx"> # Mulberry extensions
</span></span></pre></div>
<a id="PyCalendartrunksrcpycalendaricalendarpropertypy"></a>
<div class="modfile"><h4>Modified: PyCalendar/trunk/src/pycalendar/icalendar/property.py (14300 => 14301)</h4>
<pre class="diff"><span>
<span class="info">--- PyCalendar/trunk/src/pycalendar/icalendar/property.py        2015-01-14 15:38:08 UTC (rev 14300)
+++ PyCalendar/trunk/src/pycalendar/icalendar/property.py        2015-01-14 15:39:56 UTC (rev 14301)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> ##
</span><del>-# Copyright (c) 2007-2013 Cyrus Daboo. All rights reserved.
</del><ins>+# Copyright (c) 2007-2015 Cyrus Daboo. All rights reserved.
</ins><span class="cx"> #
</span><span class="cx"> # Licensed under the Apache License, Version 2.0 (the "License");
</span><span class="cx"> # you may not use this file except in compliance with the License.
</span><span class="lines">@@ -105,10 +105,12 @@
</span><span class="cx"> # Extensions: draft-york-vpoll-00.txt
</span><span class="cx"> # Section 4.2
</span><span class="cx"> definitions.cICalProperty_ACCEPT_RESPONSE : Value.VALUETYPE_TEXT,
</span><del>- definitions.cICalProperty_POLL_ITEM_ID : Value.VALUETYPE_TEXT,
- definitions.cICalProperty_POLL_WINNER : Value.VALUETYPE_TEXT,
</del><ins>+ definitions.cICalProperty_POLL_COMPLETION : Value.VALUETYPE_TEXT,
+ definitions.cICalProperty_POLL_ITEM_ID : Value.VALUETYPE_INTEGER,
</ins><span class="cx"> definitions.cICalProperty_POLL_MODE : Value.VALUETYPE_TEXT,
</span><span class="cx"> definitions.cICalProperty_POLL_PROPERTIES : Value.VALUETYPE_TEXT,
</span><ins>+ definitions.cICalProperty_POLL_WINNER : Value.VALUETYPE_INTEGER,
+ definitions.cICalProperty_RESPONSE : Value.VALUETYPE_INTEGER,
</ins><span class="cx"> definitions.cICalProperty_VOTER : Value.VALUETYPE_CALADDRESS,
</span><span class="cx">
</span><span class="cx"> # Apple Extensions
</span></span></pre></div>
<a id="PyCalendartrunksrcpycalendaricalendarteststest_vpollpy"></a>
<div class="modfile"><h4>Modified: PyCalendar/trunk/src/pycalendar/icalendar/tests/test_vpoll.py (14300 => 14301)</h4>
<pre class="diff"><span>
<span class="info">--- PyCalendar/trunk/src/pycalendar/icalendar/tests/test_vpoll.py        2015-01-14 15:38:08 UTC (rev 14300)
+++ PyCalendar/trunk/src/pycalendar/icalendar/tests/test_vpoll.py        2015-01-14 15:39:56 UTC (rev 14301)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> ##
</span><del>-# Copyright (c) 2007-2013 Cyrus Daboo. All rights reserved.
</del><ins>+# Copyright (c) 2007-2015 Cyrus Daboo. All rights reserved.
</ins><span class="cx"> #
</span><span class="cx"> # Licensed under the Apache License, Version 2.0 (the "License");
</span><span class="cx"> # you may not use this file except in compliance with the License.
</span><span class="lines">@@ -32,8 +32,16 @@
</span><span class="cx"> ORGANIZER:mailto:user01@example.com
</span><span class="cx"> POLL-MODE:BASIC
</span><span class="cx"> POLL-PROPERTIES:DTSTART,DTEND
</span><ins>+BEGIN:VVOTER
</ins><span class="cx"> VOTER;CN=User 02:mailto:user02@example.com
</span><ins>+BEGIN:VOTE
+POLL-ITEM-ID:1
+RESPONSE:100
+END:VOTE
+END:VVOTER
+BEGIN:VVOTER
</ins><span class="cx"> VOTER;CN=User 03:mailto:user03@example.com
</span><ins>+END:VVOTER
</ins><span class="cx"> BEGIN:VEVENT
</span><span class="cx"> UID:C3184A66-1ED0-11D9-A5E0-000A958A3252
</span><span class="cx"> DTSTART;VALUE=DATE:20130101
</span><span class="lines">@@ -63,11 +71,21 @@
</span><span class="cx"> UID:A979D282-2CDB-484F-BD63-3972094DFFC0
</span><span class="cx"> DTSTAMP:20020101T000000Z
</span><span class="cx"> ORGANIZER:mailto:user01@example.com
</span><del>-POLL-ITEM-ID;PUBLIC-COMMENT=Not ideal;RESPONSE=50:1
-POLL-ITEM-ID;PUBLIC-COMMENT=Perfect;RESPONSE=100:2
</del><span class="cx"> POLL-MODE:BASIC
</span><span class="cx"> POLL-PROPERTIES:DTSTART,DTEND
</span><ins>+BEGIN:VVOTER
</ins><span class="cx"> VOTER;CN=User 02:mailto:user02@example.com
</span><ins>+BEGIN:VOTE
+POLL-ITEM-ID:1
+RESPONSE:50
+COMMENT:Not ideal
+END:VOTE
+BEGIN:VOTE
+POLL-ITEM-ID:2
+RESPONSE:100
+COMMENT:Perfect
+END:VOTE
+END:VVOTER
</ins><span class="cx"> END:VPOLL
</span><span class="cx"> END:VCALENDAR
</span><span class="cx"> """,
</span></span></pre></div>
<a id="PyCalendartrunksrcpycalendaricalendarvotepy"></a>
<div class="addfile"><h4>Added: PyCalendar/trunk/src/pycalendar/icalendar/vote.py (0 => 14301)</h4>
<pre class="diff"><span>
<span class="info">--- PyCalendar/trunk/src/pycalendar/icalendar/vote.py         (rev 0)
+++ PyCalendar/trunk/src/pycalendar/icalendar/vote.py        2015-01-14 15:39:56 UTC (rev 14301)
</span><span class="lines">@@ -0,0 +1,51 @@
</span><ins>+##
+# Copyright (c) 2011-2015 Cyrus Daboo. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+##
+
+from pycalendar.icalendar import definitions
+from pycalendar.icalendar.component import Component
+from pycalendar.icalendar.validation import ICALENDAR_VALUE_CHECKS
+
+class Vote(Component):
+
+ propertyCardinality_1 = (
+ )
+
+ propertyCardinality_0_1 = (
+ definitions.cICalProperty_POLL_ITEM_ID,
+ definitions.cICalProperty_RESPONSE,
+ )
+
+ propertyValueChecks = ICALENDAR_VALUE_CHECKS
+
+ def __init__(self, parent=None):
+ super(Vote, self).__init__(parent=parent)
+
+
+ def duplicate(self, parent=None):
+ return super(Vote, self).duplicate(parent=parent)
+
+
+ def getType(self):
+ return definitions.cICalComponent_VOTE
+
+
+ def sortedPropertyKeyOrder(self):
+ return (
+ definitions.cICalProperty_POLL_ITEM_ID,
+ definitions.cICalProperty_RESPONSE,
+ )
+
+Component.registerComponent(definitions.cICalComponent_VOTE, Vote)
</ins></span></pre></div>
<a id="PyCalendartrunksrcpycalendaricalendarvpollpy"></a>
<div class="modfile"><h4>Modified: PyCalendar/trunk/src/pycalendar/icalendar/vpoll.py (14300 => 14301)</h4>
<pre class="diff"><span>
<span class="info">--- PyCalendar/trunk/src/pycalendar/icalendar/vpoll.py        2015-01-14 15:38:08 UTC (rev 14300)
+++ PyCalendar/trunk/src/pycalendar/icalendar/vpoll.py        2015-01-14 15:39:56 UTC (rev 14301)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> ##
</span><del>-# Copyright (c) 2007-2013 Cyrus Daboo. All rights reserved.
</del><ins>+# Copyright (c) 2007-2015 Cyrus Daboo. All rights reserved.
</ins><span class="cx"> #
</span><span class="cx"> # Licensed under the Apache License, Version 2.0 (the "License");
</span><span class="cx"> # you may not use this file except in compliance with the License.
</span><span class="lines">@@ -39,6 +39,7 @@
</span><span class="cx"> definitions.cICalProperty_LAST_MODIFIED,
</span><span class="cx"> definitions.cICalProperty_POLL_MODE,
</span><span class="cx"> definitions.cICalProperty_POLL_PROPERTIES,
</span><ins>+ definitions.cICalProperty_POLL_WINNER,
</ins><span class="cx"> definitions.cICalProperty_PRIORITY,
</span><span class="cx"> definitions.cICalProperty_SEQUENCE,
</span><span class="cx"> definitions.cICalProperty_STATUS,
</span><span class="lines">@@ -67,13 +68,18 @@
</span><span class="cx">
</span><span class="cx"> def sortedComponents(self):
</span><span class="cx"> """
</span><del>- Also take POLL-ID into account
</del><ins>+ Also take VVOTER and POLL-ID into account
</ins><span class="cx"> """
</span><span class="cx">
</span><span class="cx"> components = self.mComponents[:]
</span><span class="cx">
</span><del>- # Write out the remainder sorted by name, sortKey
- return sorted(components, key=lambda x: (x.getType().upper(), x.loadValueString(definitions.cICalProperty_POLL_ITEM_ID),))
</del><ins>+ # VVOTER sorts above components with POLL-ITEM-ID
+ def _sortKey(subcomponent):
+ if subcomponent.getType().upper() == definitions.cICalComponent_VVOTER:
+ return ("0", subcomponent.loadValueString(definitions.cICalProperty_VOTER),)
+ else:
+ return (subcomponent.getType().upper(), subcomponent.loadValueInteger(definitions.cICalProperty_POLL_ITEM_ID),)
+ return sorted(components, key=_sortKey)
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx"> Component.registerComponent(definitions.cICalComponent_VPOLL, VPoll)
</span></span></pre></div>
<a id="PyCalendartrunksrcpycalendaricalendarvvoterpy"></a>
<div class="addfile"><h4>Added: PyCalendar/trunk/src/pycalendar/icalendar/vvoter.py (0 => 14301)</h4>
<pre class="diff"><span>
<span class="info">--- PyCalendar/trunk/src/pycalendar/icalendar/vvoter.py         (rev 0)
+++ PyCalendar/trunk/src/pycalendar/icalendar/vvoter.py        2015-01-14 15:39:56 UTC (rev 14301)
</span><span class="lines">@@ -0,0 +1,71 @@
</span><ins>+##
+# Copyright (c) 2011-2015 Cyrus Daboo. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+##
+
+from pycalendar.icalendar import definitions
+from pycalendar.icalendar.component import Component
+from pycalendar.icalendar.validation import ICALENDAR_VALUE_CHECKS
+
+class VVoter(Component):
+
+ propertyCardinality_1 = (
+ definitions.cICalProperty_VOTER,
+ )
+
+ propertyCardinality_0_1 = (
+ definitions.cICalProperty_CREATED,
+ definitions.cICalProperty_DESCRIPTION,
+ definitions.cICalProperty_LAST_MODIFIED,
+ definitions.cICalProperty_SUMMARY,
+ definitions.cICalProperty_URL,
+ )
+
+ propertyValueChecks = ICALENDAR_VALUE_CHECKS
+
+ def __init__(self, parent=None):
+ super(VVoter, self).__init__(parent=parent)
+
+
+ def duplicate(self, parent=None):
+ return super(VVoter, self).duplicate(parent=parent)
+
+
+ def getType(self):
+ return definitions.cICalComponent_VVOTER
+
+
+ def addComponent(self, comp):
+ # We can embed the available components only
+ if comp.getType() == definitions.cICalComponent_VOTE:
+ super(VVoter, self).addComponent(comp)
+ else:
+ raise ValueError
+
+
+ def sortedPropertyKeyOrder(self):
+ return (
+ definitions.cICalProperty_VOTER,
+ )
+
+
+ def sortedComponents(self):
+ """
+ Also take POLL-ITEM-ID into account
+ """
+
+ components = self.mComponents[:]
+ return sorted(components, key=lambda x: x.loadValueInteger(definitions.cICalProperty_POLL_ITEM_ID))
+
+Component.registerComponent(definitions.cICalComponent_VVOTER, VVoter)
</ins></span></pre>
</div>
</div>
</body>
</html>