gavo.web.productrender module

Code dealing with product (i.e., fits file) delivery.

class gavo.web.productrender.MissingPreview[source]

Bases: Resource

A twisted resource returning a 404 image.

noPreviewImg = b'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00\xc8\x00\x00\x00d\x02\x03\x00\x00\x00\xbe\xe8\x97\x98\x00\x00\x00\x0cPLTE\x10\x12\x0fNPM\x90\x92\x8f\xfc\xff\xfb^\xc5[\x0b\x00\x00\x00\x01bKGD\x00\x88\x05\x1dH\x00\x00\x00\tpHYs\x00\x00\x0b\x13\x00\x00\x0b\x13\x01\x00\x9a\x9c\x18\x00\x00\x00\x07tIME\x07\xe4\x08\x0c\x0c#\x16x\xc0<\x19\x00\x00\x02\xb4IDATX\xc3\xed\xd4?h\x13Q\x1c\x07\xf0n\x1d2t*"\x079TpJs\xe0 B\xff<\xe8\xd0EP\xa8\xa3\xa0\x83C\x11\x8a\x82\x83d\xb8\x9a\x82b\x87\x82\xc1v\xd1\xa9\x94\n"B\xb5P!\xca]\x1eX\xda@oh\xd3\x1b\nui\xef\rE\x1c\x9a\xf7\xbc\xc0K{w?\x7fwm\xcc\xb5M\xa1\x1dt\xe9e\xb8\xf7\xcb\xe5>\xb9\xdf%\xef\xfbk\x833\xbf\xda\x12\x92\x90\x84$$!\t9\x7f\xa4\xae\xfc=\x11\x90\xb5\x80\xe0Zk^#Z\x11g\xb2I\xb4\xef~\x1eW\xdex\x9foM\xac\xd8\x19\xed\x85Gc\xc4\'\xadI\x19\xdc\xc7\x1bO\xdf\xfa\xe1\xb5\xea\x1b\xcfT\xc0\xbf\xe4+\xe0M\xc3\x80L\x81\x18\xab+S?*\x14^\xd3&\xa9\xd0ukqn\xd8\x08\xeb\xdb\xc3E\xce\x80\xf3\x9a\x00O\x1f\xd1M\x02\xd5\xb9=VXI\x13(\x91&\x91\xa9q{\xa1\xea\xe5\xc2\xba\xd0\xf3\x85\tp\xb8\xe3"\xc9\x99\xbd\x0498\xd6+\xa2\xe1s\xc6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\x9c\xff\xb8\xa2\xcev\xff\x8a\x93E\xcd\xf2S\x92j\xabT\xed\x80:\xf4\xe3\x7f\xc2\rS7\xc3\x19 \x87x\xe9\xa2\x8b\x1f)\xf6Ic\xfc\x94{\xec\xff\x90$\xc8\tIHB\x12r~\xc8\x1f\xb7$\xb4\xb3\x18\x0b\xb3\x99\x00\x00\x00\x00IEND\xaeB`\x82'
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}

class gavo.web.productrender.ProductRenderer(request, service)[source]

Bases: ServiceBasedPage

The renderer used for delivering products.

This will only work with a ProductCore since the resulting data set has to contain products.Resources. Thus, you probably will not use this in user RDs.

getChild(name, request)[source]

Retrieve a ‘child’ resource from me.

Implement this to create dynamic resource generation – resources which are always available may be registered with self.putChild().

This will not be called if the class-level variable ‘isLeaf’ is set in your subclass; instead, the ‘postpath’ attribute of the request will be left as a list of the remaining path elements.

For example, the URL /foo/bar/baz will normally be:

| site.resource.getChild('foo').getChild('bar').getChild('baz').

However, if the resource returned by ‘bar’ has isLeaf set to true, then the getChild call will never be made on it.

Parameters and return value have the same meaning and requirements as those defined by L{IResource.getChildWithDefault}.

name = 'get'
pathFromSegments = ''
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}