[CalendarServer-changes] [15431] CalendarServer/trunk/simplugin/caldavclient.py
source_changes at macosforge.org
source_changes at macosforge.org
Fri Jan 8 13:21:15 PST 2016
Revision: 15431
http://trac.calendarserver.org//changeset/15431
Author: sagen at apple.com
Date: 2016-01-08 13:21:15 -0800 (Fri, 08 Jan 2016)
Log Message:
-----------
_request and _addDefaultHeaders has been relocated to the new sim baseclient
Modified Paths:
--------------
CalendarServer/trunk/simplugin/caldavclient.py
Modified: CalendarServer/trunk/simplugin/caldavclient.py
===================================================================
--- CalendarServer/trunk/simplugin/caldavclient.py 2016-01-08 21:03:23 UTC (rev 15430)
+++ CalendarServer/trunk/simplugin/caldavclient.py 2016-01-08 21:21:15 UTC (rev 15431)
@@ -452,64 +452,8 @@
- def _addDefaultHeaders(self, headers):
- """
- Add the clients default set of headers to ones being used in a request.
- Default is to add User-Agent, sub-classes should override to add other
- client specific things, Accept etc.
- """
- headers.setRawHeaders('User-Agent', [self.USER_AGENT])
- @inlineCallbacks
- def _request(self, expectedResponseCodes, method, url, headers=None, body=None, method_label=None):
- """
- Execute a request and check against the expected response codes.
- """
- if type(expectedResponseCodes) is int:
- expectedResponseCodes = (expectedResponseCodes,)
- if headers is None:
- headers = Headers({})
- self._addDefaultHeaders(headers)
- msg(
- type="request",
- method=method_label if method_label else method,
- url=url,
- user=self.record.uid,
- client_type=self.title,
- client_id=self._client_id,
- )
-
- before = self.reactor.seconds()
- response = yield self.agent.request(method, url, headers, body)
-
- # XXX This is time to receive response headers, not time
- # to receive full response. Should measure the latter, if
- # not both.
- after = self.reactor.seconds()
-
- success = response.code in expectedResponseCodes
-
- msg(
- type="response",
- success=success,
- method=method_label if method_label else method,
- headers=headers,
- body=body,
- code=response.code,
- user=self.record.uid,
- client_type=self.title,
- client_id=self._client_id,
- duration=(after - before),
- url=url,
- )
-
- if success:
- returnValue(response)
-
- raise IncorrectResponseCode(expectedResponseCodes, response)
-
-
def _parseMultiStatus(self, response, otherTokens=False):
"""
Parse a <multistatus> - might need to return other top-level elements
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20160108/4ebe120c/attachment.html>
More information about the calendarserver-changes
mailing list