Exemplo n.º 1
0
 def _explain_custom(cls, service):
     res = T.invisible["a custom rendering of the service, typically"
                       " for interactive web applications."]
     if svcs.getRenderer("custom").isBrowseable(service):
         res["  See also the ",
             T.a(href=service.getURL("custom"))["entry page"], "."]
     return res
def getInputParams(publication, service):
    """returns a sequence of vs:param elements for the input of service.
	"""
    if hasattr(service, "getInputKeysFor"):  # no params on published tables
        return [
            getInputParamFromColumn(f) for f in service.getInputKeysFor(
                svcs.getRenderer(publication.render))
        ]
Exemplo n.º 3
0
def getDatalinkCore(dlSvc, ssaTable):
    """returns a datalink core adapted for ssaTable.

	dlSvc is the datalink service, ssaTable a non-empty SSA result table.
	"""
    allowedRendsForStealing = ["dlget"]  #noflake: for stealVar downstack
    totalRow = _combineRowIntoOne(ssaTable.rows)
    desc = SSADescriptor.fromSSARow(totalRow, ssaTable.getParamDict())
    return dlSvc.core.adaptForDescriptors(svcs.getRenderer("dlget"), [desc])
Exemplo n.º 4
0
def getRendererDocs(docStructure):
    from gavo.svcs import RENDERER_REGISTRY, getRenderer
    content = RSTFragment()
    for rendName in sorted(RENDERER_REGISTRY):
        rend = getRenderer(rendName)
        if rend.__doc__:
            content.addHead1("The %s Renderer" % rendName)
            metaStuff = "*This renderer's parameter style is \"%s\"." % (
                rend.parameterStyle)
            if not rend.checkedRenderer:
                metaStuff += "  This is an unchecked renderer."
            content.addNormalizedPara(metaStuff + "*")
            content.addNormalizedPara(rend.__doc__)
    return content.content
Exemplo n.º 5
0
	def _locateResourceBasedChild(self, ctx, segments):
		"""returns a standard, resource-based service renderer.

		Their URIs look like <rd id>/<service id>{/<anything>}.

		This works by successively trying to use parts of the query path 
		of increasing length as RD ids.  If one matches, the next
		segment is the service id, and the following one the renderer.

		The remaining segments are returned unconsumed.

		If no RD matches, an UnknwownURI exception is raised.
		"""
		for srvInd in range(1, len(segments)):
			try:
				rd = base.caches.getRD("/".join(segments[:srvInd]))
			except base.RDNotFound:
				continue
			else:
				break
		else:
			raise UnknownURI("No matching RD")
		try:
			subId, rendName = segments[srvInd], segments[srvInd+1]
		except IndexError:
			# a URL requesting a default renderer
			subId, rendName = segments[srvInd], None
			
		service = rd.getService(subId)
		if service is None:
			if rd.hasProperty("superseded-url"):
				return weberrors.NotFoundPageWithFancyMessage([
					"This resource is stale and has been superseded; you should really"
					" not be directed here.  Anyway, you might find what you"
					" were looking for at this ",
					T.a(href=rd.getProperty("superseded-url"))["new location"],
					"."]), ()
			raise UnknownURI("No such service: %s"%subId, rd=rd)

		if not rendName:
			rendName = service.defaultRenderer
		if rendName is None:
			raise UnknownURI("No renderer given and service has no default")
		try:
			rendC = svcs.getRenderer(rendName)
		except Exception, exc:
			exc.rd = rd
			raise