Re: Fwd: surprising #include directory

"R. Tyler Ballance" <[email protected]>
Newsgroups gmane.comp.python.cheetah
Message-ID <[email protected]>
Mark, start filing bugs if you care so much about this stuff.

Stop reposting year+ old messages

On Mon, May 18, 2009 at 12:49:08PM -0700, [email protected] wrote:
>    ---------- Forwarded message ----------
>    From: Forest <[email protected]>
>    Date: Sun, Jul 15, 2007 at 12:25 PM
>    Subject: [Cheetahtemplate-discuss] surprising #include directory
>    To: [email protected]
> 
>    Can someone explain how to make Cheetah look in a template's directory
>    when
>    searching for its #include files?  It seems to be looking in the process's
>    current working directory instead, which has several problems:
> 
>    It is non-intuitive.  When #include is written in a template file, the
>    developer who wrote it would reasonably expect it to find files relative
>    to
>    that template's directory, not some unrelated directory.  (This is
>    especially true for traditional web developers, who use relative URLs in
>    an
>    HTML page to find other pages in the same directory.)
> 
>    It is unpredictable to the template developer.  The directory that
>    #include
>    currently searches will vary depending on the running state of a program,
>    which is very likely controlled by someone else, and cannot be determined
>    when writing the template.  This means a template-only developer has no
>    reliable way to know how #include will behave, which makes it nearly
>    useless
>    to a large part of Cheetah's target audience.
> 
>    It is inconsistent with Python's import statement.  Not that Cheetah's
>    #include and Python's import are the same thing, but since Cheetah is
>    primarily used in python programs, it would be rather convenient for
>    python
>    programmers if they didn't have to remember special-case behavior for
>    commands that pull content in from separate files.  At the very least, it
>    would make Cheetah easier to learn and remember.
> 
>    It fails when a web application is deployed differently.  As long as
>    #include behavior depends on a process's working directory, site
>    administrators will have limited options in how they deploy their web
>    applications.  If their new favorite container runs in a different
>    directory
>    than the original one, the site will break.  That's a rather onerous
>    limitation for a template system to impose.
> 
>    I imagine these problems could be worked around by compiling the templates
>    before deploying, but honestly, that extra work is not worth my time until
>    a
>    site becomes popular enough to need the extra execution speed.  (And for
>    most sites, that means never.)  During development, I would no longer be
>    able to simply save changes in my editor window and reload in my browser
>    window.  I would also have to find a third window and run a command line
>    or
>    three, every time I made the smallest change.  It only takes a few dozen
>    changes to make that a hassle and a waste of effort.
> 
>    Rather than changing Cheetah's default behavior (for fear of breaking
>    backward compatibility), perhaps a more suitable #include path could be
>    set
>    via Template.__init__()?
> 
>    For now, I guess I'll have to avoid using #include in my templates.
>     That's
>    a shame, because #include "header.tmpl" would be an elegant way to express
>    an operation that is very common in web development.
> 
>    -------------------------------------------------------------------------
>    This SF.net email is sponsored by DB2 Express
>    Download DB2 Express C - the FREE version of DB2 express and take
>    control of your XML. No limits. Just data. Click to get it now.
>    http://sourceforge.net/powerbar/db2/
>    _______________________________________________
>    Cheetahtemplate-discuss mailing list
>    [email protected]
>    https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
> 
>    --
>    Bidegg worlds best auction site
>    http://bidegg.com

-- 
-R. Tyler Ballance
Slide, Inc.

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables 
unlimited royalty-free distribution of the report engine 
for externally facing server and web deployment. 
http://p.sf.net/sfu/businessobjects

_______________________________________________
Cheetahtemplate-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
signature.asc (application/pgp-signature, 197 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)

iEYEARECAAYFAkoRyl8ACgkQFCbH3D9R4W8j1gCeKxReNJ0B5cwQ0RIroBW7CJ/E
m5UAoKS267TSJu9u/XUvRah1unHfzyE7
=S2UF
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.