Beispiel #1
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)
	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)
Beispiel #3
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)
Beispiel #4
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['Compress'] is True:
            appendXmlTextNode("Compress", str(self.info['Compress']).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)