| 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 caldavclientlibrary.protocol.webdav.requestresponse import RequestResponse 18 from caldavclientlibrary.protocol.webdav.definitions import methods 19 from StringIO import StringIO 20 from caldavclientlibrary.protocol.http.data.string import RequestDataString 21 from caldavclientlibrary.protocol.webdav.definitions import davxml 22 from xml.etree.ElementTree import Element 23 from caldavclientlibrary.protocol.utils.xmlhelpers import BetterElementTree 24266828 super(ACL, self).__init__(session, methods.ACL, url) 29 self.acls = acls 30 31 self.initRequestData()3234 # Write XML info to a string 35 os = StringIO() 36 self.generateXML(os) 37 self.request_data = RequestDataString(os.getvalue(), "text/xml charset=utf-8")3840 # Structure of document is: 41 # 42 # <DAV:acl> 43 # <DAV:ace> 44 # <S:inheritable xmlns:S="http:#jakarta.apache.org/slide/"> / <S:non-inheritable xmlns:S="http:#jakarta.apache.org/slide/"> 45 # <DAV:principal>...</DAV:principal> 46 # <DAV:grant>...</DAV:grant> 47 # </DAV:ace> 48 # ... 49 # </DAV:acl> 50 51 # <DAV:acl> element 52 acl = Element(davxml.acl) 53 54 # Do for each ACL 55 if self.acls: 56 57 for ace in self.acls: 58 # Cannot do if change not allowed 59 if not ace.canChange(): 60 continue 61 62 # <DAV:ace> element 63 ace.generateACE(acl) 64 65 # Now we have the complete document, so write it out (no indentation) 66 xmldoc = BetterElementTree(acl) 67 xmldoc.writeUTF8(os)
| Home | Trees | Indices | Help |
|---|
| Generated by Epydoc 3.0.1 on Thu Jul 7 15:01:48 2011 | http://epydoc.sourceforge.net |