[prev in list] [next in list] [prev in thread] [next in thread]
List: calendarserver-changes
Subject: [CalendarServer-changes] [15442] CalDAVTester/trunk
From: source_changes () macosforge ! org
Date: 2016-01-22 21:22:35
Message-ID: 20160122212236.1490D140EE5 () svn ! calendarserver ! org
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
Revision: 15442
http://trac.calendarserver.org//changeset/15442
Author: cdaboo@apple.com
Date: 2016-01-22 13:22:35 -0800 (Fri, 22 Jan 2016)
Log Message:
-----------
Make pycalendar imports optional. Clean-up.
Modified Paths:
--------------
CalDAVTester/trunk/.project
CalDAVTester/trunk/src/caldavtest.py
CalDAVTester/trunk/src/request.py
CalDAVTester/trunk/verifiers/addressDataMatch.py
CalDAVTester/trunk/verifiers/calendarDataMatch.py
CalDAVTester/trunk/verifiers/freeBusy.py
CalDAVTester/trunk/verifiers/postFreeBusy.py
CalDAVTester/trunk/verifiers/xmlElementMatch.py
Modified: CalDAVTester/trunk/.project
===================================================================
--- CalDAVTester/trunk/.project 2016-01-22 18:27:32 UTC (rev 15441)
+++ CalDAVTester/trunk/.project 2016-01-22 21:22:35 UTC (rev 15442)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
- <name>caldavtester</name>
+ <name>CalDAVTester</name>
<comment></comment>
<projects>
<project>pycalendar</project>
@@ -15,15 +15,4 @@
<natures>
<nature>org.python.pydev.pythonNature</nature>
</natures>
- <filteredResources>
- <filter>
- <id>1395855144585</id>
- <name></name>
- <type>10</type>
- <matcher>
- <id>org.eclipse.ui.ide.multiFilter</id>
- <arguments>1.0-projectRelativePath-matches-true-false-.develop</arguments>
- </matcher>
- </filter>
- </filteredResources>
</projectDescription>
Modified: CalDAVTester/trunk/src/caldavtest.py
===================================================================
--- CalDAVTester/trunk/src/caldavtest.py 2016-01-22 18:27:32 UTC (rev 15441)
+++ CalDAVTester/trunk/src/caldavtest.py 2016-01-22 21:22:35 UTC (rev 15442)
@@ -19,7 +19,11 @@
"""
from cStringIO import StringIO
-from pycalendar.icalendar.calendar import Calendar
+try:
+ # Treat pycalendar as optional
+ from pycalendar.icalendar.calendar import Calendar
+except ImportError:
+ pass
from src.httpshandler import SmartHTTPConnection
from src.jsonPointer import JSONMatcher
from src.manager import manager
@@ -751,7 +755,7 @@
if stats:
stats.endTimer()
- if doverify and (respdata != None):
+ if doverify and (respdata is not None):
result, txt = self.verifyrequest(req, uri, response, respdata)
resulttxt += txt
elif forceverify:
@@ -784,7 +788,7 @@
tree = ElementTree(file=StringIO(respdata))
ctr = len(tree.findall("{DAV:}response")) - 1
- if ctr == None or ctr == -1:
+ if ctr is None or ctr == -1:
result = False
resulttxt += "\nCould not count resources in response\n"
else:
@@ -804,7 +808,7 @@
for propname, variable in req.grabproperty:
# grab the property here
propvalue = self.extractProperty(propname, respdata)
- if propvalue == None:
+ if propvalue is None:
result = False
resulttxt += "\nProperty %s was not extracted from \
multistatus response\n" % (propname,) else:
@@ -820,7 +824,7 @@
parent = self.manager.server_info.extrasubs(parent)
# grab the property here
elementvalues = self.extractElements(elementpath, parent, respdata)
- if elementvalues == None:
+ if elementvalues is None:
result = False
resulttxt += "\nElement %s was not extracted from response\n" % \
(elementpath,) elif len(variables) != len(elementvalues):
@@ -834,7 +838,7 @@
for pointer, variables in req.grabjson:
# grab the JSON value here
pointervalues = self.extractPointer(pointer, respdata)
- if pointervalues == None:
+ if pointervalues is None:
result = False
resulttxt += "\Pointer %s was not extracted from response\n" % \
(pointer,) elif len(variables) != len(pointervalues):
@@ -850,7 +854,7 @@
propname = self.manager.server_info.subs(propname)
propname = self.manager.server_info.extrasubs(propname)
propvalue = self.extractCalProperty(propname, respdata)
- if propvalue == None:
+ if propvalue is None:
result = False
resulttxt += "\nCalendar property %s was not extracted from \
response\n" % (propname,) else:
@@ -862,7 +866,7 @@
paramname = self.manager.server_info.subs(paramname)
paramname = self.manager.server_info.extrasubs(paramname)
paramvalue = self.extractCalParameter(paramname, respdata)
- if paramvalue == None:
+ if paramvalue is None:
result = False
resulttxt += "\nCalendar Parameter %s was not extracted from \
response\n" % (paramname,) else:
Modified: CalDAVTester/trunk/src/request.py
===================================================================
--- CalDAVTester/trunk/src/request.py 2016-01-22 18:27:32 UTC (rev 15441)
+++ CalDAVTester/trunk/src/request.py 2016-01-22 21:22:35 UTC (rev 15442)
@@ -206,7 +206,7 @@
hdrs[key] = si.extrasubs(value)
# Content type
- if self.data != None:
+ if self.data is not None:
hdrs["Content-Type"] = self.data.content_type
# Auth
@@ -308,7 +308,7 @@
def getFilePath(self):
- if self.data != None:
+ if self.data is not None:
return os.path.join(self.manager.data_dir, self.data.filepath) if \
self.manager.data_dir else self.data.filepath else:
return ""
@@ -316,7 +316,7 @@
def getData(self):
data = ""
- if self.data != None:
+ if self.data is not None:
if len(self.data.value) != 0:
data = self.data.value
elif self.data.filepath:
Modified: CalDAVTester/trunk/verifiers/addressDataMatch.py
===================================================================
--- CalDAVTester/trunk/verifiers/addressDataMatch.py 2016-01-22 18:27:32 UTC (rev \
15441)
+++ CalDAVTester/trunk/verifiers/addressDataMatch.py 2016-01-22 21:22:35 UTC (rev \
15442) @@ -15,7 +15,11 @@
##
from difflib import unified_diff
-from pycalendar.vcard.card import Card
+try:
+ # pycalendar is optional
+ from pycalendar.vcard.card import Card
+except ImportError:
+ pass
import os
"""
Modified: CalDAVTester/trunk/verifiers/calendarDataMatch.py
===================================================================
--- CalDAVTester/trunk/verifiers/calendarDataMatch.py 2016-01-22 18:27:32 UTC (rev \
15441)
+++ CalDAVTester/trunk/verifiers/calendarDataMatch.py 2016-01-22 21:22:35 UTC (rev \
15442) @@ -15,9 +15,13 @@
##
from difflib import unified_diff
-from pycalendar.icalendar.calendar import Calendar
-from pycalendar.icalendar.componentrecur import ComponentRecur
-from pycalendar.parameter import Parameter
+try:
+ # pycalendar is optional
+ from pycalendar.icalendar.calendar import Calendar
+ from pycalendar.icalendar.componentrecur import ComponentRecur
+ from pycalendar.parameter import Parameter
+except ImportError:
+ pass
import os
"""
Modified: CalDAVTester/trunk/verifiers/freeBusy.py
===================================================================
--- CalDAVTester/trunk/verifiers/freeBusy.py 2016-01-22 18:27:32 UTC (rev 15441)
+++ CalDAVTester/trunk/verifiers/freeBusy.py 2016-01-22 21:22:35 UTC (rev 15442)
@@ -18,9 +18,15 @@
Verifier that checks the response of a free-busy-query.
"""
-from pycalendar.icalendar.calendar import Calendar
-from pycalendar.exceptions import InvalidData
+try:
+ # pycalendar is optional
+ from pycalendar.icalendar.calendar import Calendar
+ from pycalendar.exceptions import InvalidData
+except ImportError:
+ pass
+
+
class Verifier(object):
def verify(self, manager, uri, response, respdata, args): #@UnusedVariable
@@ -104,5 +110,7 @@
return False, " HTTP response data is not a calendar"
except ValueError, txt:
return False, " HTTP response data is invalid: %s" % (txt,)
+ except Exception, e:
+ return False, " Response data is not calendar data: %s" % (e,)
return True, ""
Modified: CalDAVTester/trunk/verifiers/postFreeBusy.py
===================================================================
--- CalDAVTester/trunk/verifiers/postFreeBusy.py 2016-01-22 18:27:32 UTC (rev 15441)
+++ CalDAVTester/trunk/verifiers/postFreeBusy.py 2016-01-22 21:22:35 UTC (rev 15442)
@@ -18,8 +18,12 @@
Verifier that checks the response of a free-busy-query.
"""
-from pycalendar.icalendar.calendar import Calendar
-from pycalendar.exceptions import InvalidData
+try:
+ # pycalendar is optional
+ from pycalendar.icalendar.calendar import Calendar
+ from pycalendar.exceptions import InvalidData
+except ImportError:
+ pass
from xml.etree.cElementTree import ElementTree
from xml.parsers.expat import ExpatError
import StringIO
@@ -124,6 +128,8 @@
return False, " HTTP response data is not a calendar"
except ValueError, txt:
return False, " HTTP response data is invalid: %s" % (txt,)
+ except Exception, e:
+ return False, " Response data is not calendar data: %s" % \
(e,)
if len(users):
return False, " Could not find attendee/calendar data in XML \
response\n"
Modified: CalDAVTester/trunk/verifiers/xmlElementMatch.py
===================================================================
--- CalDAVTester/trunk/verifiers/xmlElementMatch.py 2016-01-22 18:27:32 UTC (rev \
15441)
+++ CalDAVTester/trunk/verifiers/xmlElementMatch.py 2016-01-22 21:22:35 UTC (rev \
15442) @@ -19,7 +19,11 @@
Verifier that checks the response body for an exact match to data in a file.
"""
-from pycalendar.icalendar.calendar import Calendar
+try:
+ # pycalendar is optional
+ from pycalendar.icalendar.calendar import Calendar
+except ImportError:
+ pass
from xml.etree.cElementTree import ElementTree
import json
import re
[Attachment #5 (text/html)]
<!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>[15442] CalDAVTester/trunk</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/15442">15442</a></dd> <dt>Author</dt> \
<dd>cdaboo@apple.com</dd> <dt>Date</dt> <dd>2016-01-22 13:22:35 -0800 (Fri, 22 Jan \
2016)</dd> </dl>
<h3>Log Message</h3>
<pre>Make pycalendar imports optional. Clean-up.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#CalDAVTestertrunkproject">CalDAVTester/trunk/.project</a></li>
<li><a href="#CalDAVTestertrunksrccaldavtestpy">CalDAVTester/trunk/src/caldavtest.py</a></li>
<li><a href="#CalDAVTestertrunksrcrequestpy">CalDAVTester/trunk/src/request.py</a></li>
<li><a href="#CalDAVTestertrunkverifiersaddressDataMatchpy">CalDAVTester/trunk/verifiers/addressDataMatch.py</a></li>
<li><a href="#CalDAVTestertrunkverifierscalendarDataMatchpy">CalDAVTester/trunk/verifiers/calendarDataMatch.py</a></li>
<li><a href="#CalDAVTestertrunkverifiersfreeBusypy">CalDAVTester/trunk/verifiers/freeBusy.py</a></li>
<li><a href="#CalDAVTestertrunkverifierspostFreeBusypy">CalDAVTester/trunk/verifiers/postFreeBusy.py</a></li>
<li><a href="#CalDAVTestertrunkverifiersxmlElementMatchpy">CalDAVTester/trunk/verifiers/xmlElementMatch.py</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="CalDAVTestertrunkproject"></a>
<div class="modfile"><h4>Modified: CalDAVTester/trunk/.project (15441 => 15442)</h4>
<pre class="diff"><span>
<span class="info">--- CalDAVTester/trunk/.project 2016-01-22 18:27:32 UTC (rev \
15441)
+++ CalDAVTester/trunk/.project 2016-01-22 21:22:35 UTC (rev 15442)
</span><span class="lines">@@ -1,6 +1,6 @@
</span><span class="cx"> <?xml version="1.0" \
encoding="UTF-8"?> </span><span class="cx"> <projectDescription>
</span><del>- <name>caldavtester</name>
</del><ins>+ <name>CalDAVTester</name>
</ins><span class="cx"> <comment></comment>
</span><span class="cx"> <projects>
</span><span class="cx"> <project>pycalendar</project>
</span><span class="lines">@@ -15,15 +15,4 @@
</span><span class="cx"> <natures>
</span><span class="cx"> <nature>org.python.pydev.pythonNature</nature>
</span><span class="cx"> </natures>
</span><del>- <filteredResources>
- <filter>
- <id>1395855144585</id>
- <name></name>
- <type>10</type>
- <matcher>
- <id>org.eclipse.ui.ide.multiFilter</id>
- <arguments>1.0-projectRelativePath-matches-true-false-.develop</arguments>
- </matcher>
- </filter>
- </filteredResources>
</del><span class="cx"> </projectDescription>
</span></span></pre></div>
<a id="CalDAVTestertrunksrccaldavtestpy"></a>
<div class="modfile"><h4>Modified: CalDAVTester/trunk/src/caldavtest.py (15441 => \
15442)</h4> <pre class="diff"><span>
<span class="info">--- CalDAVTester/trunk/src/caldavtest.py 2016-01-22 18:27:32 UTC \
(rev 15441)
+++ CalDAVTester/trunk/src/caldavtest.py 2016-01-22 21:22:35 UTC (rev 15442)
</span><span class="lines">@@ -19,7 +19,11 @@
</span><span class="cx"> """
</span><span class="cx">
</span><span class="cx"> from cStringIO import StringIO
</span><del>-from pycalendar.icalendar.calendar import Calendar
</del><ins>+try:
+ # Treat pycalendar as optional
+ from pycalendar.icalendar.calendar import Calendar
+except ImportError:
+ pass
</ins><span class="cx"> from src.httpshandler import SmartHTTPConnection
</span><span class="cx"> from src.jsonPointer import JSONMatcher
</span><span class="cx"> from src.manager import manager
</span><span class="lines">@@ -751,7 +755,7 @@
</span><span class="cx"> if stats:
</span><span class="cx"> stats.endTimer()
</span><span class="cx">
</span><del>- if doverify and (respdata != None):
</del><ins>+ if doverify and (respdata is not None):
</ins><span class="cx"> result, txt = self.verifyrequest(req, uri, \
response, respdata) </span><span class="cx"> resulttxt += txt
</span><span class="cx"> elif forceverify:
</span><span class="lines">@@ -784,7 +788,7 @@
</span><span class="cx"> tree = ElementTree(file=StringIO(respdata))
</span><span class="cx"> ctr = \
len(tree.findall("{DAV:}response")) - 1 </span><span class="cx">
</span><del>- if ctr == None or ctr == -1:
</del><ins>+ if ctr is None or ctr == -1:
</ins><span class="cx"> result = False
</span><span class="cx"> resulttxt += "\nCould not count \
resources in response\n" </span><span class="cx"> else:
</span><span class="lines">@@ -804,7 +808,7 @@
</span><span class="cx"> for propname, variable in req.grabproperty:
</span><span class="cx"> # grab the property here
</span><span class="cx"> propvalue = \
self.extractProperty(propname, respdata) </span><del>- if \
propvalue == None: </del><ins>+ if propvalue is None:
</ins><span class="cx"> result = False
</span><span class="cx"> resulttxt += "\nProperty %s was \
not extracted from multistatus response\n" % (propname,) </span><span \
class="cx"> else: </span><span class="lines">@@ -820,7 +824,7 @@
</span><span class="cx"> parent = \
self.manager.server_info.extrasubs(parent) </span><span class="cx"> # \
grab the property here </span><span class="cx"> elementvalues = \
self.extractElements(elementpath, parent, respdata) </span><del>- if \
elementvalues == None: </del><ins>+ if elementvalues is None:
</ins><span class="cx"> result = False
</span><span class="cx"> resulttxt += "\nElement %s was not \
extracted from response\n" % (elementpath,) </span><span class="cx"> \
elif len(variables) != len(elementvalues): </span><span class="lines">@@ -834,7 \
+838,7 @@ </span><span class="cx"> for pointer, variables in \
req.grabjson: </span><span class="cx"> # grab the JSON value here
</span><span class="cx"> pointervalues = self.extractPointer(pointer, \
respdata) </span><del>- if pointervalues == None:
</del><ins>+ if pointervalues is None:
</ins><span class="cx"> result = False
</span><span class="cx"> resulttxt += "\Pointer %s was not \
extracted from response\n" % (pointer,) </span><span class="cx"> \
elif len(variables) != len(pointervalues): </span><span class="lines">@@ -850,7 \
+854,7 @@ </span><span class="cx"> propname = \
self.manager.server_info.subs(propname) </span><span class="cx"> \
propname = self.manager.server_info.extrasubs(propname) </span><span class="cx"> \
propvalue = self.extractCalProperty(propname, respdata) </span><del>- \
if propvalue == None: </del><ins>+ if propvalue is None:
</ins><span class="cx"> result = False
</span><span class="cx"> resulttxt += "\nCalendar property \
%s was not extracted from response\n" % (propname,) </span><span class="cx"> \
else: </span><span class="lines">@@ -862,7 +866,7 @@
</span><span class="cx"> paramname = \
self.manager.server_info.subs(paramname) </span><span class="cx"> \
paramname = self.manager.server_info.extrasubs(paramname) </span><span class="cx"> \
paramvalue = self.extractCalParameter(paramname, respdata) </span><del>- \
if paramvalue == None: </del><ins>+ if paramvalue is None:
</ins><span class="cx"> result = False
</span><span class="cx"> resulttxt += "\nCalendar Parameter \
%s was not extracted from response\n" % (paramname,) </span><span class="cx"> \
else: </span></span></pre></div>
<a id="CalDAVTestertrunksrcrequestpy"></a>
<div class="modfile"><h4>Modified: CalDAVTester/trunk/src/request.py (15441 => \
15442)</h4> <pre class="diff"><span>
<span class="info">--- CalDAVTester/trunk/src/request.py 2016-01-22 18:27:32 UTC (rev \
15441)
+++ CalDAVTester/trunk/src/request.py 2016-01-22 21:22:35 UTC (rev 15442)
</span><span class="lines">@@ -206,7 +206,7 @@
</span><span class="cx"> hdrs[key] = si.extrasubs(value)
</span><span class="cx">
</span><span class="cx"> # Content type
</span><del>- if self.data != None:
</del><ins>+ if self.data is not None:
</ins><span class="cx"> hdrs["Content-Type"] = \
self.data.content_type </span><span class="cx">
</span><span class="cx"> # Auth
</span><span class="lines">@@ -308,7 +308,7 @@
</span><span class="cx">
</span><span class="cx">
</span><span class="cx"> def getFilePath(self):
</span><del>- if self.data != None:
</del><ins>+ if self.data is not None:
</ins><span class="cx"> return os.path.join(self.manager.data_dir, \
self.data.filepath) if self.manager.data_dir else self.data.filepath </span><span \
class="cx"> else: </span><span class="cx"> return ""
</span><span class="lines">@@ -316,7 +316,7 @@
</span><span class="cx">
</span><span class="cx"> def getData(self):
</span><span class="cx"> data = ""
</span><del>- if self.data != None:
</del><ins>+ if self.data is not None:
</ins><span class="cx"> if len(self.data.value) != 0:
</span><span class="cx"> data = self.data.value
</span><span class="cx"> elif self.data.filepath:
</span></span></pre></div>
<a id="CalDAVTestertrunkverifiersaddressDataMatchpy"></a>
<div class="modfile"><h4>Modified: CalDAVTester/trunk/verifiers/addressDataMatch.py \
(15441 => 15442)</h4> <pre class="diff"><span>
<span class="info">--- CalDAVTester/trunk/verifiers/addressDataMatch.py 2016-01-22 \
18:27:32 UTC (rev 15441)
+++ CalDAVTester/trunk/verifiers/addressDataMatch.py 2016-01-22 21:22:35 UTC (rev \
15442) </span><span class="lines">@@ -15,7 +15,11 @@
</span><span class="cx"> ##
</span><span class="cx">
</span><span class="cx"> from difflib import unified_diff
</span><del>-from pycalendar.vcard.card import Card
</del><ins>+try:
+ # pycalendar is optional
+ from pycalendar.vcard.card import Card
+except ImportError:
+ pass
</ins><span class="cx"> import os
</span><span class="cx">
</span><span class="cx"> """
</span></span></pre></div>
<a id="CalDAVTestertrunkverifierscalendarDataMatchpy"></a>
<div class="modfile"><h4>Modified: CalDAVTester/trunk/verifiers/calendarDataMatch.py \
(15441 => 15442)</h4> <pre class="diff"><span>
<span class="info">--- CalDAVTester/trunk/verifiers/calendarDataMatch.py 2016-01-22 \
18:27:32 UTC (rev 15441)
+++ CalDAVTester/trunk/verifiers/calendarDataMatch.py 2016-01-22 21:22:35 UTC (rev \
15442) </span><span class="lines">@@ -15,9 +15,13 @@
</span><span class="cx"> ##
</span><span class="cx">
</span><span class="cx"> from difflib import unified_diff
</span><del>-from pycalendar.icalendar.calendar import Calendar
-from pycalendar.icalendar.componentrecur import ComponentRecur
-from pycalendar.parameter import Parameter
</del><ins>+try:
+ # pycalendar is optional
+ from pycalendar.icalendar.calendar import Calendar
+ from pycalendar.icalendar.componentrecur import ComponentRecur
+ from pycalendar.parameter import Parameter
+except ImportError:
+ pass
</ins><span class="cx"> import os
</span><span class="cx">
</span><span class="cx"> """
</span></span></pre></div>
<a id="CalDAVTestertrunkverifiersfreeBusypy"></a>
<div class="modfile"><h4>Modified: CalDAVTester/trunk/verifiers/freeBusy.py (15441 => \
15442)</h4> <pre class="diff"><span>
<span class="info">--- CalDAVTester/trunk/verifiers/freeBusy.py 2016-01-22 18:27:32 \
UTC (rev 15441)
+++ CalDAVTester/trunk/verifiers/freeBusy.py 2016-01-22 21:22:35 UTC (rev 15442)
</span><span class="lines">@@ -18,9 +18,15 @@
</span><span class="cx"> Verifier that checks the response of a free-busy-query.
</span><span class="cx"> """
</span><span class="cx">
</span><del>-from pycalendar.icalendar.calendar import Calendar
-from pycalendar.exceptions import InvalidData
</del><ins>+try:
+ # pycalendar is optional
+ from pycalendar.icalendar.calendar import Calendar
+ from pycalendar.exceptions import InvalidData
+except ImportError:
+ pass
</ins><span class="cx">
</span><ins>+
+
</ins><span class="cx"> class Verifier(object):
</span><span class="cx">
</span><span class="cx"> def verify(self, manager, uri, response, respdata, \
args): #@UnusedVariable </span><span class="lines">@@ -104,5 +110,7 @@
</span><span class="cx"> return False, " HTTP response data \
is not a calendar" </span><span class="cx"> except ValueError, txt:
</span><span class="cx"> return False, " HTTP response data \
is invalid: %s" % (txt,) </span><ins>+ except Exception, e:
+ return False, " Response data is not calendar data: %s" \
% (e,) </ins><span class="cx">
</span><span class="cx"> return True, ""
</span></span></pre></div>
<a id="CalDAVTestertrunkverifierspostFreeBusypy"></a>
<div class="modfile"><h4>Modified: CalDAVTester/trunk/verifiers/postFreeBusy.py \
(15441 => 15442)</h4> <pre class="diff"><span>
<span class="info">--- CalDAVTester/trunk/verifiers/postFreeBusy.py 2016-01-22 \
18:27:32 UTC (rev 15441)
+++ CalDAVTester/trunk/verifiers/postFreeBusy.py 2016-01-22 21:22:35 UTC (rev 15442)
</span><span class="lines">@@ -18,8 +18,12 @@
</span><span class="cx"> Verifier that checks the response of a free-busy-query.
</span><span class="cx"> """
</span><span class="cx">
</span><del>-from pycalendar.icalendar.calendar import Calendar
-from pycalendar.exceptions import InvalidData
</del><ins>+try:
+ # pycalendar is optional
+ from pycalendar.icalendar.calendar import Calendar
+ from pycalendar.exceptions import InvalidData
+except ImportError:
+ pass
</ins><span class="cx"> from xml.etree.cElementTree import ElementTree
</span><span class="cx"> from xml.parsers.expat import ExpatError
</span><span class="cx"> import StringIO
</span><span class="lines">@@ -124,6 +128,8 @@
</span><span class="cx"> return False, " HTTP response \
data is not a calendar" </span><span class="cx"> except ValueError, \
txt: </span><span class="cx"> return False, " HTTP \
response data is invalid: %s" % (txt,) </span><ins>+ except \
Exception, e: + return False, " Response data is not \
calendar data: %s" % (e,) </ins><span class="cx">
</span><span class="cx"> if len(users):
</span><span class="cx"> return False, " Could not find \
attendee/calendar data in XML response\n" </span></span></pre></div>
<a id="CalDAVTestertrunkverifiersxmlElementMatchpy"></a>
<div class="modfile"><h4>Modified: CalDAVTester/trunk/verifiers/xmlElementMatch.py \
(15441 => 15442)</h4> <pre class="diff"><span>
<span class="info">--- CalDAVTester/trunk/verifiers/xmlElementMatch.py 2016-01-22 \
18:27:32 UTC (rev 15441)
+++ CalDAVTester/trunk/verifiers/xmlElementMatch.py 2016-01-22 21:22:35 UTC (rev \
15442) </span><span class="lines">@@ -19,7 +19,11 @@
</span><span class="cx"> Verifier that checks the response body for an exact match to \
data in a file. </span><span class="cx"> """
</span><span class="cx">
</span><del>-from pycalendar.icalendar.calendar import Calendar
</del><ins>+try:
+ # pycalendar is optional
+ from pycalendar.icalendar.calendar import Calendar
+except ImportError:
+ pass
</ins><span class="cx"> from xml.etree.cElementTree import ElementTree
</span><span class="cx"> import json
</span><span class="cx"> import re
</span></span></pre>
</div>
</div>
</body>
</html>
_______________________________________________
calendarserver-changes mailing list
calendarserver-changes@lists.macosforge.org
https://lists.macosforge.org/mailman/listinfo/calendarserver-changes
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic