| Home | Trees | Indices | Help |
|---|
|
|
1 ## 2 # Copyright (c) 2007-2016 Apple Inc. All rights reserved. 3 # 4 # Licensed under the Apache License, Version 2.0 (the "License"); 5 # you may not use this file except in compliance with the License. 6 # You may obtain a copy of the License at 7 # 8 # http://www.apache.org/licenses/LICENSE-2.0 9 # 10 # Unless required by applicable law or agreed to in writing, software 11 # distributed under the License is distributed on an "AS IS" BASIS, 12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 # See the License for the specific language governing permissions and 14 # limitations under the License. 15 ## 16 17 from xml.etree.ElementTree import Element 18 from caldavclientlibrary.protocol.webdav.definitions import davxml 19 from caldavclientlibrary.protocol.utils.xmlhelpers import BetterElementTree 20 from caldavclientlibrary.protocol.webdav.requestresponse import RequestResponse 21 from xml.etree.ElementTree import SubElement 22 from caldavclientlibrary.protocol.webdav.definitions import methods 23 from caldavclientlibrary.protocol.http.data.string import RequestDataString 24 from StringIO import StringIO 25277629 super(PropPatch, self).__init__(session, methods.PROPPATCH, url) 30 self.setprops = setprops 31 self.delprops = delprops 32 33 self.initRequestData()3436 # Write XML info to a string 37 os = StringIO() 38 self.generateXML(os); 39 self.request_data = RequestDataString(os.getvalue(), "text/xml; charset=utf-8");4042 self.response_data = response_data4345 # Structure of document is: 46 # 47 # <DAV:propertyupdate> 48 # <DAV:set> 49 # <<names/values of each property as elements>> 50 # </DAV:set> 51 # <DAV:remove> 52 # <<names of each property as elements>> 53 # </DAV:remove> 54 # </DAV:propertyupdate> 55 56 # <DAV:propertyupdate> element 57 propertyupdate = Element(davxml.propertyupdate) 58 59 # <DAV:set> element 60 if self.setprops: 61 set = SubElement(propertyupdate, davxml.set) 62 propel = SubElement(set, davxml.prop) 63 for prop in self.setprops: 64 propel.append(prop) 65 66 # <DAV:remove> element 67 if self.delprops: 68 remove = SubElement(propertyupdate, davxml.remove) 69 propel = SubElement(remove, davxml.prop) 70 for prop in self.delprops: 71 propel.append(prop) 72 73 # Now we have the complete document, so write it out (no indentation) 74 xmldoc = BetterElementTree(propertyupdate) 75 xmldoc.writeUTF8(os)
| Home | Trees | Indices | Help |
|---|
| Generated by Epydoc 3.0.1 on Thu Jul 7 15:01:49 2011 | http://epydoc.sourceforge.net |