Пример #1
0
    def __str__(self):
        tree = ET.Element("InvalidationBatch")

        for path in self.paths:
            if path[0] != "/":
                path = "/" + path
            appendXmlTextNode("Path", path, tree)
        appendXmlTextNode("CallerReference", self.reference, tree)
        return ET.tostring(tree)
Пример #2
0
	def __str__(self):
		tree = ET.Element("InvalidationBatch")

		for path in self.paths:
			if path[0] != "/":
				path = "/" + path
			appendXmlTextNode("Path", path, tree)
		appendXmlTextNode("CallerReference", self.reference, tree)
		return ET.tostring(tree)
Пример #3
0
    def __str__(self):
        tree = ET.Element("InvalidationBatch")
        s3 = S3(Config())

        for path in self.paths:
            if len(path) < 1 or path[0] != "/":
                path = "/" + path
            appendXmlTextNode("Path", s3.urlencode_string(path), tree)
        appendXmlTextNode("CallerReference", self.reference, tree)
        return ET.tostring(tree)
Пример #4
0
    def __str__(self):
        tree = ET.Element("InvalidationBatch")
        s3 = S3(Config())

        for path in self.paths:
            if len(path) < 1 or path[0] != "/":
                path = "/" + path
            appendXmlTextNode("Path", s3.urlencode_string(path), tree)
        appendXmlTextNode("CallerReference", self.reference, tree)
        return ET.tostring(tree)
Пример #5
0
	def __str__(self):
		tree = ET.Element("DistributionConfig")
		tree.attrib['xmlns'] = DistributionConfig.xmlns

		## Retain the order of the following calls!
		appendXmlTextNode("Origin", self.info['Origin'], tree)
		appendXmlTextNode("CallerReference", self.info['CallerReference'], tree)
		for cname in self.info['CNAME']:
			appendXmlTextNode("CNAME", cname.lower(), tree)
		if self.info['Comment']:
			appendXmlTextNode("Comment", self.info['Comment'], tree)
		appendXmlTextNode("Enabled", str(self.info['Enabled']).lower(), tree)

		return ET.tostring(tree)
Пример #6
0
    def __str__(self):
        tree = ET.Element("DistributionConfig")
        tree.attrib['xmlns'] = DistributionConfig.xmlns

        ## Retain the order of the following calls!
        appendXmlTextNode("Origin", self.info['Origin'], tree)
        appendXmlTextNode("CallerReference", self.info['CallerReference'],
                          tree)
        for cname in self.info['CNAME']:
            appendXmlTextNode("CNAME", cname.lower(), tree)
        if self.info['Comment']:
            appendXmlTextNode("Comment", self.info['Comment'], tree)
        appendXmlTextNode("Enabled", str(self.info['Enabled']).lower(), tree)

        return ET.tostring(tree)
Пример #7
0
	def __str__(self):
		tree = ET.Element("DistributionConfig")
		tree.attrib['xmlns'] = DistributionConfig.xmlns

		## Retain the order of the following calls!
		appendXmlTextNode("Origin", self.info['Origin'], tree)
		appendXmlTextNode("CallerReference", self.info['CallerReference'], tree)
		for cname in self.info['CNAME']:
			appendXmlTextNode("CNAME", cname.lower(), tree)
		if self.info['Comment']:
			appendXmlTextNode("Comment", self.info['Comment'], tree)
		appendXmlTextNode("Enabled", str(self.info['Enabled']).lower(), tree)
		# don't create a empty DefaultRootObject element as it would result in a MalformedXML error
		if str(self.info['DefaultRootObject']):
			appendXmlTextNode("DefaultRootObject", str(self.info['DefaultRootObject']), tree)
		if self.info['Logging']:
			logging_el = ET.Element("Logging")
			appendXmlTextNode("Bucket", getHostnameFromBucket(self.info['Logging'].bucket()), logging_el)
			appendXmlTextNode("Prefix", self.info['Logging'].object(), logging_el)
			tree.append(logging_el)
		return ET.tostring(tree)
Пример #8
0
    def __str__(self):
        tree = ET.Element("DistributionConfig")
        tree.attrib['xmlns'] = DistributionConfig.xmlns

        ## Retain the order of the following calls!
        s3org = appendXmlTextNode("S3Origin", '', tree)
        appendXmlTextNode("DNSName", self.info['S3Origin']['DNSName'], s3org)
        appendXmlTextNode("CallerReference", self.info['CallerReference'],
                          tree)
        for cname in self.info['CNAME']:
            appendXmlTextNode("CNAME", cname.lower(), tree)
        if self.info['Comment']:
            appendXmlTextNode("Comment", self.info['Comment'], tree)
        appendXmlTextNode("Enabled", str(self.info['Enabled']).lower(), tree)
        # don't create a empty DefaultRootObject element as it would result in a MalformedXML error
        if str(self.info['DefaultRootObject']):
            appendXmlTextNode("DefaultRootObject",
                              str(self.info['DefaultRootObject']), tree)
        if self.info['Logging']:
            logging_el = ET.Element("Logging")
            appendXmlTextNode(
                "Bucket", getHostnameFromBucket(self.info['Logging'].bucket()),
                logging_el)
            appendXmlTextNode("Prefix", self.info['Logging'].object(),
                              logging_el)
            tree.append(logging_el)
        return ET.tostring(tree)
Пример #9
0
	def __str__(self):
		tree = ET.Element("DistributionConfig")
		tree.attrib['xmlns'] = DistributionConfig.xmlns

		## Retain the order of the following calls!
		appendXmlTextNode("Origin", self.info['Origin'], tree)
		appendXmlTextNode("CallerReference", self.info['CallerReference'], tree)
		for cname in self.info['CNAME']:
			appendXmlTextNode("CNAME", cname.lower(), tree)
		if self.info['Comment']:
			appendXmlTextNode("Comment", self.info['Comment'], tree)
		appendXmlTextNode("Enabled", str(self.info['Enabled']).lower(), tree)
		if self.info['Logging']:
			logging_el = ET.Element("Logging")
			appendXmlTextNode("Bucket", getHostnameFromBucket(self.info['Logging'].bucket()), logging_el)
			appendXmlTextNode("Prefix", self.info['Logging'].object(), logging_el)
			tree.append(logging_el)
		return ET.tostring(tree)