예제 #1
0
def applications_v2_xml(request):
    all_apps = StackBuilderApp.objects.select_related().filter(active=True)

    resp = HttpResponse(content_type='text/xml')
    x = PgXmlHelper(resp, skipempty=True)
    x.startDocument()
    x.startElement('applications', {})
    for a in all_apps:
        x.startElement('application', {})
        x.add_xml_element('id', a.textid)
        x.add_xml_element('platform', a.platform)
        x.add_xml_element('secondaryplatform', a.secondaryplatform)
        x.add_xml_element('version', a.version)
        x.add_xml_element('name', a.name)
        x.add_xml_element('description', a.description)
        x.add_xml_element('category', a.category)
        x.add_xml_element('pgversion', a.pgversion)
        x.add_xml_element('edbversion', a.edbversion)
        x.add_xml_element('format', a.format)
        x.add_xml_element('installoptions', a.installoptions)
        x.add_xml_element('upgradeoptions', a.upgradeoptions)
        x.add_xml_element('checksum', a.checksum)
        x.add_xml_element('mirrorpath', a.mirrorpath)
        x.add_xml_element('alturl', a.alturl)
        x.add_xml_element('versionkey', a.versionkey)
        x.add_xml_element('manifesturl', a.manifesturl)
        for dep in a.txtdependencies.split(','):
            x.add_xml_element('dependency', dep)
        x.endElement('application')
    x.endElement('applications')
    x.endDocument()
    return resp
예제 #2
0
def _make_sitemap(pagelist):
	resp = HttpResponse(content_type='text/xml')
	x = PgXmlHelper(resp)
	x.startDocument()
	x.startElement('urlset', {'xmlns': 'http://www.sitemaps.org/schemas/sitemap/0.9'})
	pages = 0
	for p in pagelist:
		pages+=1
		x.startElement('url', {})
		x.add_xml_element('loc', 'https://www.postgresql.org/%s' % urllib.quote(p[0]))
		if len(p) > 1 and p[1]:
			x.add_xml_element('priority', unicode(p[1]))
		if len(p) > 2 and p[2]:
			x.add_xml_element('lastmod', p[2].isoformat() + "Z")
		x.endElement('url')
	x.endElement('urlset')
	x.endDocument()
	return resp