| 1 |
""" |
| 2 |
Services, cores, and support. |
| 3 |
|
| 4 |
A Service is something that receives a twisted web request (or perhaps |
| 5 |
something a bit more digested from formal), processes it into input data using |
| 6 |
a ContextGrammar pipes the resulting CoreArgs instance through a core to |
| 7 |
receive a data set and optionally tinkers with that data set. |
| 8 |
|
| 9 |
A core receives a CoreArgs thing, processes it, and returns something. |
| 10 |
That something typically is a table (an instance of something derived |
| 11 |
from rsc.BaseTable), and if it is, then service will adapt it |
| 12 |
to its outputTable (if necessary), wrap it into an rsc.Data instance |
| 13 |
and return it. |
| 14 |
|
| 15 |
Other core results will be handed through as-is, ignoring the service's |
| 16 |
outputTable. There are two things many renderers understand: For one, |
| 17 |
complete rsc.Data instances, which you'll want if your core produces |
| 18 |
multi-table results. And secondly, a pair of (media type, bytes), which |
| 19 |
instructs several renderers to write bytes to the client with with |
| 20 |
content-type set to media type. |
| 21 |
|
| 22 |
|
| 23 |
Support code is in common. Most importantly, this is QueryMeta, a data |
| 24 |
structure carrying lots of information on the query being processed. |
| 25 |
""" |
| 26 |
|
| 27 |
#c Copyright 2008-2025, the GAVO project <[email protected]> |
| 28 |
#c |
| 29 |
#c This program is free software, covered by the GNU GPL. See the |
| 30 |
#c COPYING file in the source distribution. |
| 31 |
|
| 32 |
|
| 33 |
# Not checked by pyflakes: API file with gratuitous imports |
| 34 |
|
| 35 |
from gavo.svcs.common import (Error, UnknownURI, ForbiddenURI, WebRedirect, |
| 36 |
RedirectBase, SeeOther, Authenticate, BadMethod, Found, |
| 37 |
RequestEntityTooLarge, BadRequest, |
| 38 |
QueryMeta, emptyQueryMeta, getTemplatePath, loadSystemTemplate) |
| 39 |
|
| 40 |
from gavo.svcs.core import getCore, Core, CORE_REGISTRY |
| 41 |
|
| 42 |
from gavo.svcs.customcore import CustomCore |
| 43 |
|
| 44 |
from gavo.svcs.customwidgets import (DBOptions, FormalDict, |
| 45 |
SimpleSelectChoice, |
| 46 |
NumericExpressionField, DateExpressionField, StringExpressionField, |
| 47 |
ScalingTextArea) |
| 48 |
|
| 49 |
from gavo.svcs.inputdef import ( |
| 50 |
CoreArgs, InputTD, InputKey, ContextGrammar) |
| 51 |
|
| 52 |
from gavo.svcs.outputdef import OutputField, OutputTableDef |
| 53 |
|
| 54 |
from gavo.svcs.renderers import RENDERER_REGISTRY, getRenderer |
| 55 |
|
| 56 |
from gavo.svcs.service import (Service, Publication, PreparsedInput, |
| 57 |
GetURLMixin) |
| 58 |
|
| 59 |
from gavo.svcs.standardcores import (DBCore, CondDesc, NullCore, |
| 60 |
mapDBErrors) |
| 61 |
|
| 62 |
from gavo.svcs.uploadcores import UploadCore |
| 63 |
|
| 64 |
from gavo.svcs.vanity import getVanityMap |
| 65 |
|
| 66 |
from gavo.svcs.weberrors import renderDCErrorPage, getDCErrorPage |