Templates and paths

2 views
Skip to first unread message

catalin...@gmail.com

unread,
Dec 8, 2006, 7:38:11 AM12/8/06
to TurboGears
Hi,

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

Karl Guertin

unread,
Dec 8, 2006, 3:12:38 PM12/8/06
to turbo...@googlegroups.com
On 12/8/06, catalin...@gmail.com <catalin...@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

catalin...@gmail.com

unread,
Dec 11, 2006, 7:51:21 AM12/11/06
to TurboGears
Karl,

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

Adam Jones

unread,
Dec 11, 2006, 11:18:05 AM12/11/06
to TurboGears

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

Reply all
Reply to author
Forward
0 new messages