gavo.web.vodal module

Support for IVOA DAL and registry protocols.

DALI-specified protocols are in dalirender, UWS/async is in asyncrender.

class gavo.web.vodal.APIRenderer(request, *args, **kwargs)[source]

Bases: UnifiedDALRenderer

A renderer that works like a VO standard renderer but that doesn’t actually follow a given protocol.

Use this for improvised APIs. The default output format is a VOTable, and the errors come in VOSI VOTables. The renderer does, however, evaluate basic DALI parameters. You can declare that by including <FEED source=”//pql#DALIPars”/> in your service.

These will return basic service metadata if passed MAXREC=0.

name = 'api'
parameterStyle = 'dali'
class gavo.web.vodal.DALRenderer(request, *args, **kwargs)[source]

Bases: ServiceBasedPage

A base class for renderers for the usual IVOA DAL protocols.

This is for simple, GET-based DAL renderers (where we allow POST as well). They work using nevow forms, but with standard-compliant error reporting (i.e., in VOTables).

Since DALRenderer mixes in FormMixin, it always has the form genFrom.

defaultOutputFormat = 'votable'
classmethod isBrowseable(service)[source]

returns True if this renderer applied to service is usable using a plain web browser.

classmethod makeAccessURL(baseURL)[source]

returns an accessURL for a service with baseURL to this renderer.

render(request, sync=False)[source]

runs the service and arranges for output to be produced.

This will in general result in a deferred, except if you pass sync=True, in which case the thing tries to run everything in one go.

Don’t do that outside of unit tests.

renderSync(request)[source]
resultType = 'application/x-votable+xml'
standardId = None
urlUse = 'base'
class gavo.web.vodal.DatalinkGetDataRenderer(request, service)[source]

Bases: _DatalinkRendererBase

A renderer for data processing by datalink cores.

This must go together with a datalink core, nothing else will do.

This renderer will actually produce the processed data. It must be complemented by the dlmeta renderer which allows retrieving metadata.

attachResult = True
name = 'dlget'
standardId = 'ivo://ivoa.net/std/soda#sync-1.0'
class gavo.web.vodal.DatalinkGetMetaRenderer(request, service)[source]

Bases: _DatalinkRendererBase

A renderer for data processing by datalink cores.

This must go together with a datalink core, nothing else will do.

This renderer will return the links and services applicable to one or more pubDIDs.

See `Datalink and SODA`_ for more information.

name = 'dlmeta'
parameterStyle = 'dali'
resultType = 'application/x-votable+xml;content=datalink'
standardId = 'ivo://ivoa.net/std/datalink'
class gavo.web.vodal.RegistryRenderer(request, service)[source]

Bases: ServiceBasedPage

A renderer that works with registry.oaiinter to provide an OAI-PMH interface.

The core is expected to return a stanxml tree.

name = 'pubreg.xml'
render(request)[source]

Render a given resource. See L{IResource}’s render method.

I delegate to methods of self with the form ‘render_METHOD’ where METHOD is the HTTP that was used to make the request. Examples: render_GET, render_HEAD, render_POST, and so on. Generally you should implement those methods instead of overriding this one.

render_METHOD methods are expected to return a byte string which will be the rendered page, unless the return value is C{server.NOT_DONE_YET}, in which case it is this class’s responsibility to write the results using C{request.write(data)} and then call C{request.finish()}.

Old code that overrides render() directly is likewise expected to return a byte string or NOT_DONE_YET.

@see: L{IResource.render}

resultType = 'text/xml'
urlUse = 'base'
class gavo.web.vodal.SCSRenderer(request, *args, **kwargs)[source]

Bases: DALRenderer

A renderer for the Simple Cone Search protocol.

These do their error signaling in the value attribute of an INFO child of RESOURCE.

You must set the following metadata items on services using this renderer if you want to register them:

  • testQuery.ra, testQuery.dec – A position for which an object is present

    within 0.001 degrees.

name = 'scs.xml'
parameterStyle = 'dali'
standardId = 'ivo://ivoa.net/std/ConeSearch'
version = '1.0'
class gavo.web.vodal.SIAP2Renderer(request, *args, **kwargs)[source]

Bases: UnifiedDALRenderer

A renderer for SIAPv2.

In general, if you want a SIAP2 service, you’ll need something like the obscore view in the underlying table.

name = 'siap2.xml'
parameterStyle = 'dali'
standardId = 'ivo://ivoa.net/std/sia'
class gavo.web.vodal.SIAPRenderer(request, *args, **kwargs)[source]

Bases: DALRenderer

A renderer for a the Simple Image Access Protocol.

These have errors in the content of an info element, and they support metadata queries.

For registration, services using this renderer must set the following metadata items:

  • sia.type – one of Cutout, Mosaic, Atlas, Pointed, see SIAP spec

You should set the following metadata items:

  • testQuery.pos.ra, testQuery.pos.dec – RA and Dec for a query that

    yields at least one image

  • testQuery.size.ra, testQuery.size.dec – RoI extent for a query that

    yields at least one image.

You can set the following metadata items (there are defaults on them that basically communicate there are no reasonable limits on them):

  • sia.maxQueryRegionSize.(long|lat)

  • sia.maxImageExtent.(long|lat)

  • sia.maxFileSize

  • sia.maxRecord (default dalHardLimit global meta)

name = 'siap.xml'
parameterStyle = 'pql'
standardId = 'ivo://ivoa.net/std/sia'
version = '1.0'
class gavo.web.vodal.SLAPRenderer(request, *args, **kwargs)[source]

Bases: UnifiedDALRenderer

A renderer for the simple line access protocol SLAP.

For registration, you must set the following metadata on services using the slap.xml renderer:

There’s two mandatory metadata items for these:

  • slap.dataSource – one of observational/astrophysical, observational/laboratory, or theoretical

  • slap.testQuery – parameters that lead to a non-empty response. The way things are written in DaCHS, MAXREC=1 should in general work.

name = 'slap.xml'
parameterStyle = 'pql'
standardId = 'ivo://ivoa.net/std/ssap'
version = '1.0'
class gavo.web.vodal.SSAPRenderer(request, *args, **kwargs)[source]

Bases: UnifiedDALRenderer

A renderer for the simple spectral access protocol.

For registration, you must set the following metadata for the ssap.xml renderer:

  • ssap.dataSource – survey, pointed, custom, theory, artificial

  • ssap.testQuery – a query string that returns some data; REQUEST=queryData is added automatically that describe the type of data served through the service. Will usually by spectrum, but timeseries is a realistic option.

Other SSA metadata includes:

  • ssap.creationType – archival, cutout, filtered, mosaic, projection, spectralExtraction, catalogExtraction (defaults to archival)

  • ssap.complianceLevel – set to “query” when you don’t deliver SDM compliant spectra; otherwise don’t say anything, DaCHS will fill in the right value.

It is recommended to set this metadata globally on the RD, as the SSA mixin can use that metadata to fill tables with sensible values without operator intervention.

Properties supported by this renderer:

  • datalink – if present, this must be the id of a datalink service that can work with the pubDIDs in this table (don’t use this any more, datalink is handled through table-level metadata now)

  • defaultRequest – by default, requests without a REQUEST parameter will be rejected. If you set defaultRequest to querydata, such requests will be processed as if REQUEST were given (which is of course sane but is a violation of the standard).

defaultOutputFormat = 'votabletd'
name = 'ssap.xml'
parameterStyle = 'pql'
standardId = 'ivo://ivoa.net/std/ssap'
version = '1.04'
class gavo.web.vodal.UnifiedDALRenderer(request, *args, **kwargs)[source]

Bases: DALRenderer

A renderer for new-style simple DAL protocols.

All input processing (e.g., metadata queries and the like) are considered part of the individual protocol and thus left to the core.

The error style is that of SSAP (which, hopefully, will be kept for the other DAL2 protocols, too).

To define actual renderers, inherit from this and set the name attribute (plus _outputTableCasts if necessary). Also, explain any protocol-specific metadata in the docstring.

gavo.web.vodal.addAttachmentHeaders(request, mime=None)[source]

adds a content-disposition header to request with a filename guessed based on datalink arguments.

This tries a number of heuristics to try and preserve a bit of the provenance in the name, mainly to make saving these things simpler.