Exemplo n.º 1
0
Arquivo: views.py Projeto: jkatz/pgweb
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
Exemplo n.º 2
0
Arquivo: views.py Projeto: jkatz/pgweb
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.parse.quote(p[0]))
        if len(p) > 1 and p[1]:
            x.add_xml_element('priority', str(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
Exemplo n.º 3
0
def sitemap(request):
	resp = HttpResponse(mimetype='text/xml')
	x = PgXmlHelper(resp)
	x.startDocument()
	x.startElement('urlset', {'xmlns': 'http://www.sitemaps.org/schemas/sitemap/0.9'})
	pages = 0
	for p in get_all_pages_struct():
		pages+=1
		x.startElement('url', {})
		x.add_xml_element('loc', 'http://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
Exemplo n.º 4
0
def mirrors_xml(request):
	# Same as in mirrorselect
	all_mirrors = Mirror.objects.filter(mirror_active=True, mirror_private=False, mirror_dns=True).extra(where=["mirror_last_rsync>(now() - '48 hours'::interval)"]).order_by('country_name', 'mirror_index')	

	resp = HttpResponse(mimetype='text/xml')
	x = PgXmlHelper(resp)
	x.startDocument()
	x.startElement('mirrors', {})
	for m in all_mirrors:
		for protocol in m.get_all_protocols():
			x.startElement('mirror', {})
			x.add_xml_element('country', m.country_name)
			x.add_xml_element('path', m.host_path)
			x.add_xml_element('protocol', protocol)
			x.add_xml_element('hostname', m.get_host_name())
			x.endElement('mirror')
	x.endElement('mirrors')
	x.endDocument()
	return resp
Exemplo n.º 5
0
def applications_v2_xml(request):
    all_apps = StackBuilderApp.objects.select_related().filter(active=True)

    resp = HttpResponse(mimetype="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
Exemplo n.º 6
0
def sitemap(request):
    resp = HttpResponse(mimetype="text/xml")
    x = PgXmlHelper(resp)
    x.startDocument()
    x.startElement("urlset", {"xmlns": "http://www.sitemaps.org/schemas/sitemap/0.9"})
    pages = 0
    for p in get_all_pages_struct():
        pages += 1
        x.startElement("url", {})
        x.add_xml_element("loc", "http://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