def getCoreFor(self, renderer):
        """returns a core tailored for renderer.

		See svcs.core's module docstring. 
		
		The argument can be a renderer or a renderer name.
		"""
        if isinstance(renderer, basestring):
            renderer = renderers.getRenderer(renderer)

        # non-checked renderers use the core for info purposes only; don't
        # bother for those
        if not renderer.checkedRenderer:
            return self.core

        if renderer.name not in self._coresCache:
            # Bad Hack: Tell datalink core what renderers are allowed on
            # this service
            allowedRendsForStealing = self.allowed  #noflake: for stealVar downstack

            res = self.core.adaptForRenderer(renderer)

            # Hack: let the polymorphous datalink core suppress caching
            if getattr(res, "nocache", False):
                return res

            self._coresCache[renderer.name] = res
        return self._coresCache[renderer.name]
    def isBrowseableWith(self, rendName):
        """returns true if rendering this service through rendName results 
		in something pretty in a web browser.
		"""
        try:
            return bool(renderers.getRenderer(rendName).isBrowseable(self))
        except base.NotFoundError:  # renderer name not known
            return False
    def getInputKeysFor(self, renderer):
        """returns a sequence of input keys, adapted for certain renderers.

		The renderer argument may either be a renderer name, a renderer
		class or a renderer instance.

		This is the main interface for external entities to discover.
		service metadata.
		"""
        if isinstance(renderer, basestring):
            renderer = renderers.getRenderer(renderer)
        return self.getInputDDFor(renderer).grammar.inputKeys
    def run(self, renderer, args, queryMeta=None):
        """runs the service, returning an SvcResult.

		This is the main entry point for protocol renderers; args is
		a dict of lists as provided by request.args.

		Pass in queryMeta if convenient or if args is not simply request.args
		(but, e.g., nevow formal data).  Otherwise, it will be constructed
		from args.
		"""
        if isinstance(renderer, basestring):
            renderer = renderers.getRenderer(renderer)
        if queryMeta is None:
            queryMeta = common.QueryMeta.fromNevowArgs(args)

        core = self.getCoreFor(renderer)

        return self._runWithInputTable(
            core, self._makeInputTableFor(renderer, args, core=core),
            queryMeta)
    def getURL(self, rendName, absolute=True, **kwargs):
        """returns the full canonical access URL of this service together 
		with renderer.

		rendName is the name of the intended renderer in the registry
		of renderers.

		With absolute, a fully qualified URL is being returned.

		Further keyword arguments are translated into URL parameters in the
		query part.
		"""
        basePath = "%s%s/%s" % (base.getConfig(
            "web", "nevowRoot"), self.rd.sourceId, self.id)
        if absolute:
            basePath = base.getConfig("web", "serverURL") + basePath
        res = renderers.getRenderer(rendName).makeAccessURL(basePath)

        if kwargs:
            res = res + "?" + urllib.urlencode(kwargs)
        return res
 def _meta_resultType(self):
     return renderers.getRenderer(self.render).resultType
 def _meta_requestMethod(self):
     return renderers.getRenderer(self.render).preferredMethod
 def _meta_urlUse(self):
     return renderers.getRenderer(self.render).urlUse
 def validate(self):
     self._validateNext(Publication)
     try:
         renderers.getRenderer(self.render)
     except KeyError:
         raise base.StructureError("Unknown renderer: %s" % self.render)