[Kss-devel] Superfluous view registration?

Balazs Ree ree at ree.hu
Wed Mar 12 07:41:14 CET 2008


On Tue, 11 Mar 2008 23:37:42 +0100, Jeroen Vloothuis wrote:

> In kss.core's configure.zcml there is this small snippet:
> 
>     <!-- (non-kss) browser view -->
>     <browser:page
>           for="*"
>           name="kss_view"
>         permission="zope.Public"
>         class=".browserview.KSSBrowserView"
>         allowed_attributes="attach_error"
>     </browser:page>
> 
> This seems to be used only by a single test (test_browserview.py).
> Should this be something which is only registered for the tests or does
> it have some actual use ?

This is indeed not used by kss.core itself, but is implemented by 
kss.core and is used by applications, for the following:

If a server action gives an uncaught server side exception (including 
NotFound or Unauthorized), Zope renders a default error page. This view 
makes it possible that the default error page makes the server side 
exception information available for the client side, by "annotating" it 
into the page.

This is done in such a way that a kss command payload is produced that 
contains the error information. However unlike normal kss responses, the 
payload in this case is embedded into a html header (X-KSSCOMMANDS) in 
the response.

If the default error page is calling this up (like it happens in case of 
PLone), then the client side logger can actually log the server side 
error message into the (FireBug) log, instead of some meaningless error 
message "there was an error on the server".

This is, besides the unittest you mentioned, also completely tested in 
all variations in the "error" demo and selenium test. There is also a 
different zpt that is involved into the rendering of these type of 
payloads.  This kind of rendering (attaching the payload to a normal page 
response) is not used by kss for anything else then this error rendering, 
but it likely will be in the future, because it has some important 
although yet unexplored use cases (like sending some kss initially with 
the page, that can be useful in different caching scenario and for 
eventPush, etc.).

Sincerely,


-- 
Balazs Ree



More information about the Kss-devel mailing list