These questions were asked in different forms on this group but I
couldn't find a definitive (or preferred) solution. I'm pretty new to
web development and TG (but not new to Python), however, I started
reading the TG book.
I would like to use nvu to edit/create kid templates. It works OK as
long as the paths to the CSS and image files are relative (i.e.
../static/images/). It looks to me like the TG way of putting the
references is to use absolute paths (/static/images/), which I think
makes sense. To remove the "../" I could create a "static" symbolic
link in the templates directory but I couldn't find a way to use
absolute paths for static content and still see the templates properly.
Is there any solution to this? Am I taking the wrong approach?
Thanks,
Catalin
The easiest way to do this is to use the py:attrs trick:
On Dec 8, 8:12 pm, "Karl Guertin" <grayr...@gmail.com> wrote:
> On 12/8/06, catalin.mari...@gmail.com <catalin.mari...@gmail.com> wrote:
> > I would like to use nvu to edit/create kid templates. It works OK as
> > long as the paths to the CSS and image files are relative (i.e.
> > ../static/images/).The easiest way to do this is to use the py:attrs trick:
>
> http://docs.turbogears.org/1.0/Designer
Thanks for the hint. Is there any speed penalty by doing this (I
suspect Kid can replace the attributes when it compiles the templates
and speed shouldn't be affected)?
Catalin
IIRC this substitution is done at render time, not compile time. I
don't know if Kid substitutes strings in at compile time though (they
are immutable anyways, so it easily could). That said it is just
another string substitution and (if the problem exists at all) is
probably has less of a performance penalty than, for example, pulling a
string from SQLObject/SQLAlchemy.
-Adam