On September 12, 2002 08:46 pm, Edmund wrote:
> On 09/12/2002 11:39:13 PM Tavis Rudd wrote:
> >Unfortunately not. I've run into this before. Making it possible wou=
ld
> >require huge changes.
>
> Hmmm... I'm glad you replied Tavis, because the function was actually
> written to make the "file" parameter used in Cheetah Template creation
> accept relative paths.
=2E..
> So, with this, an absolute path is computed for Template. However, the
> obvious implication of this is that the template is being created durin=
g
> each awake phase, which should not be necessary. I really want to
> instantiate the template once only when the servlet is first instantiat=
ed.
Just cache the template instance after the first awake() call. Add a boo=
lean
to check if it has already been done:
_templateCreated =3D 0
def awake(self, trans):
if not self._templateCreated:
# create the template
self._templateCreated =3D 1
# keep going with the rest of your code
> What else can I do to have Cheetah work with relative paths?
Nothing. This is a webware issue, not a Cheetah one. Cheetah works fine
with relative paths, provided that they make sense from the current work=
ing
directory. ServerSidePaths are different from relative paths.
Cheers,
Tavis
-------------------------------------------------------
|