Package gavo :: Package svcs :: Module renderers
[frames] | no frames]

Source Code for Module gavo.svcs.renderers

 1  """ 
 2  A manual registry of renderers. 
 3   
 4  Renderers are the glue between a core and some output.  A service is the 
 5  combination of a subset of renderers and a core. 
 6   
 7  Renderers are actually defined in web.grend, but we need some way to 
 8  get at them from svcs and above, so the registry is kept here. 
 9  """ 
10   
11  #c Copyright 2008-2019, the GAVO project 
12  #c 
13  #c This program is free software, covered by the GNU GPL.  See the 
14  #c COPYING file in the source distribution. 
15   
16   
17  from gavo import base 
18  from gavo import utils 
19   
20   
21  RENDERER_REGISTRY = { 
22          'admin': ("web.adminrender", "AdminRenderer"), 
23          'api': ("web.vodal", "APIRenderer"), 
24          'availability': ("web.vosi", "VOSIAvailabilityRenderer"), 
25          'capabilities': ("web.vosi", "VOSICapabilityRenderer"), 
26          'coverage': ("web.metarender", "CoverageRenderer"), 
27          'custom': ("web.customrender", "CustomRenderer"), 
28          'dlasync': ("web.vodal", "DatalinkAsyncRenderer"), 
29          'dlget': ("web.vodal", "DatalinkGetDataRenderer"), 
30          'dlmeta': ("web.vodal", "DatalinkGetMetaRenderer"), 
31          'docform': ("web.formrender", "DocFormRenderer"), 
32          'edition': ("web.metarender", "EditionRenderer"), 
33          'examples': ("web.examplesrender", "Examples"), 
34          'external': ("web.metarender", "ExternalRenderer"), 
35          'fixed': ("web.constantrender", "FixedPageRenderer"), 
36          'form': ("web.formrender", "Form"), 
37          'get': ("web.productrender", "ProductRenderer"), 
38          'howtocite': ("web.metarender", "HowToCiteRenderer"), 
39          'img.jpeg': ("web.oddrender", "JpegRenderer"), 
40          'info': ("web.metarender", "ServiceInfoRenderer"), 
41          'logout': ("web.metarender", "LogoutRenderer"), 
42          'mimg.jpeg': ("web.oddrender", "MachineJpegRenderer"), 
43          'mupload': ("web.uploadservice", "MachineUploader"), 
44          'pubreg.xml': ("web.vodal", "RegistryRenderer"), 
45          'qp': ("web.qprenderer", "QPRenderer"), 
46          'rdinfo': ("web.metarender", "RDInfoRenderer"), 
47          'scs.xml': ("web.vodal", "SCSRenderer"), 
48          'siap.xml': ("web.vodal", "SIAPRenderer"), 
49          'siap2.xml': ("web.vodal", "SIAP2Renderer"), 
50          'slap.xml': ("web.vodal", "SLAPRenderer"), 
51          'soap': ("web.soaprender", "SOAPRenderer"), 
52          'ssap.xml': ("web.vodal", "SSAPRenderer"), 
53          'static': ("web.constantrender", "StaticRenderer"), 
54          'tableinfo': ("web.metarender", "TableInfoRenderer"), 
55          'tableMetadata': ("web.vosi", "VOSITablesetRenderer"), 
56          'tablenote': ("web.metarender", "TableNoteRenderer"), 
57          'tap': ("web.taprender", "TAPRenderer"), 
58          'upload': ("web.uploadservice", "Uploader"), 
59          'uws.xml': ("web.vodal", "UWSAsyncRenderer"), 
60          'volatile': ("web.constantrender", "VolatilePageRenderer"), 
61  } 
62 63 64 @utils.memoized 65 -def getRenderer(name):
66 if name not in RENDERER_REGISTRY: 67 raise base.NotFoundError(name, "renderer", "registred renderers") 68 cls = utils.loadInternalObject(*RENDERER_REGISTRY[name]) 69 if cls.name!=name: 70 raise base.ReportableError("Internal Error: Renderer %s is registred" 71 " under the wrong name."%name, 72 hint="This is probably a typo in svcs.renderers; it needs" 73 " to be fixed there") 74 return cls
75