Re: many GET requests for LivePage js modules

Jean-Paul Calderone <[email protected]> Sun, 26 Nov 2006 19:50:17 -0500
Newsgroups gmane.comp.python.quotient.dev
Message-ID <20061127005017.20948.1795435691.divmod.quotient.46585@ohm>
On Thu, 23 Nov 2006 08:19:33 +0000, Michael Graz <[email protected]> wrote:
>Greetings.  For an implementation like the following:
>
>    class Index (rend.Page):
>        addSlash = True
>        docFactory = loaders.xmlfile (util.sibpath (__file__, 'index.html'))
>        def child_main (self, ctx):
>            return MainPage ()
>
>    class MainPage (athena.LivePage):
>        docFactory = loaders.xmlfile (util.sibpath (__file__,
>'main_page.html'))
>        addSlash = True
>
>Every time MainPage is reloaded it triggers a wave of http GET requests.
>For example:
>
>    GET /main/
>    GET /main/bfacf1d9079bfb07fc119574795e9ceb/jsmodule/MochiKit
>    GET /main/bfacf1d9079bfb07fc119574795e9ceb/jsmodule/Divmod
>    GET /main/bfacf1d9079bfb07fc119574795e9ceb/jsmodule/Divmod.Defer
>    GET /main/bfacf1d9079bfb07fc119574795e9ceb/jsmodule/Divmod.Runtime
>        ...
>
>But the jsmodules above are static and not instance specific.  Is there a
>way for those to be referred to more of like a root resource than child
>resource?  Then they will not have be fetched across the net each time.

Yep.  LivePage.__init__ takes an argument, jsModuleRoot, which can either
be None, to produce the behavior you observed above, or an URL which will
be used as the root of all module requests.

Jean-Paul