gavo.web.serviceresults module

“Output drivers” for various formats, for the use of form-like renderers.

TODO: Tar and the output format widget should go somewhere else; the rest should be done by RESPONSEFORMAT and formats. Then this module should die.

class gavo.web.serviceresults.CSVResponse[source]

Bases: ServiceResult

code = 'CSV'
label = 'CSV'
class gavo.web.serviceresults.FITSTableResult[source]

Bases: ServiceResult

returns data as a FITS binary table.

code = 'FITS'
classmethod getTargetName(data)[source]
label = 'FITS table'
class gavo.web.serviceresults.JsonResponse[source]

Bases: ServiceResult

code = 'JSON'
label = 'JSON'
class gavo.web.serviceresults.OutputFormat(typeOb, service, queryMeta)[source]

Bases: object

A widget that offers various output options in close cooperation with gavo.js and QueryMeta.

The javascript provides options for customizing output that non-javascript users will not see. Also, formal doesn’t see any of these. See gavo.js for details.

This widget probably only makes sense in the Form renderer and thus should probably go there.

processInput(request, key, args)[source]
render(request, key, args, errors)[source]
renderImmutable(request, key, args, errors)
class gavo.web.serviceresults.ServiceResult[source]

Bases: object

A base class for objects producing formatted output.

They are basically wrappers for _formatOutput, which will usually be used as sources for streaming.streamOut.

All methods on these objects are class methods – they are never instantiated.

Deriving classes can override

  • _formatOutput(result, request, queryMeta) – receives the service result

    and arranges for it to be written.

  • canWrite(colSeq) – a that returns true when a seq of columns can be serialized by this service result.

  • code – an identifier used in HTTP query strings to select the format

  • label (optional) – a string that is used in HTML forms to select the format (defaults to label).

  • compute – if False, at least the form renderer will not run the service (this is when you just return a container).

classmethod canWrite(colSeq)[source]
code = None
compute = True
classmethod getLabel()[source]
label = None
class gavo.web.serviceresults.TSVResponse[source]

Bases: ServiceResult

code = 'TSV'
label = 'Text (with Tabs)'
class gavo.web.serviceresults.TarResponse[source]

Bases: ServiceResult

delivers a tar of products requested.

classmethod canWrite(colSeq)[source]
code = 'tar'
class gavo.web.serviceresults.TextResponse[source]

Bases: ServiceResult

code = 'txt'
label = 'Text (fixed columns)'
class gavo.web.serviceresults.VOTableResult[source]

Bases: ServiceResult

A ResultFormatter for VOTables.

The VOTables come as attachments, i.e., if all goes well the form will just stand as it is.

code = 'VOTable'
gavo.web.serviceresults.getFormat(formatName)[source]