Skip to search.

Breaking News Visit Yahoo! News for the latest.

×Close this window

cheetah-archive · Cheetah Template System Archive

The Yahoo! Groups Product Blog

Check it out!

Group Information

  • Members: 3
  • Category: Web Design
  • Founded: Jul 18, 2001
  • Language: English
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Hear how Yahoo! Groups has changed the lives of others. Take me there.

Messages

Advanced
Messages Help
Messages 2208 - 2237 of 5012   Oldest  |  < Older  |  Newer >  |  Newest
Messages: Show Message Summaries Sort by Date ^  
#2208 From: "Aaron Buhr" <aaron.buhr@...>
Date: Mon Aug 4, 2003 2:53 pm
Subject: [Cheetahtemplate-discuss] Having trouble with #include
aaron.buhr@...
Send Email Send Email
 
Hello all, I am hoping someone can help me out.  I am having trouble with
#include.  I am making a page that responds to a form submission.  It is
page 2 of a 4-page application that the user will be filling out.  I want
the page to do input validation and if the input needs to be corrected
refresh the user back to page 1 to re-enter (with appropriate instructions),
if the input is ok then present page 2 of the app.

	 I have no trouble with the logic to do that but with that logic and the
varying display possibilities it is confusing my visual web page design
program.  So I thought that I would just compose the regular page 2 without
the branching logic and then #include it into the page with the logic.
However my first problem was that the variables were coming up undefined,
which from reading the archives is how the #include is supposed to work -
namespace not shared or some such.  So in my #included file I then copied
over my variable assignment (from a session var) from the including file,
and now the page gives me a "'Nonetype' object is not callable error."

	 If anyone has any tips for me they would be much appreciated.  Thanks.

Aaron Buhr
Campus Communications Group, Inc.



-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
Cheetahtemplate-discuss mailing list
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

#2209 From: Mike Orr <mso@...>
Date: Mon Aug 4, 2003 3:10 pm
Subject: Re: [Cheetahtemplate-discuss] Having trouble with #include
mso@...
Send Email Send Email
 
On Mon, Aug 04, 2003 at 10:53:43AM -0400, Aaron Buhr wrote:
> However my first problem was that the variables were coming up undefined,
> which from reading the archives is how the #include is supposed to work -
> namespace not shared or some such.  So in my #included file I then copied
> over my variable assignment (from a session var) from the including file,

searchList variables should be visible automatically.  Use '#set global'
instead of '#set' for other variables that should be visible in the
included file.

> and now the page gives me a "'Nonetype' object is not callable error."

If the above doesn't help, send us a small example and we'll troubleshoot.

--
-Mike (Iron) Orr, mso@...  (iron@...)
    http://iron.cx/     English * Esperanto * Russkiy * Deutsch * Espan~ol


-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
Cheetahtemplate-discuss mailing list
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

#2210 From: "Aaron Buhr" <aaron.buhr@...>
Date: Tue Aug 5, 2003 6:03 pm
Subject: [Cheetahtemplate-discuss] Re: Having trouble with #include
aaron.buhr@...
Send Email Send Email
 
> Message: 2
> Date: Mon, 4 Aug 2003 08:10:53 -0700
> From: Mike Orr <mso@...>
> To: Cheetah Template List <cheetahtemplate-discuss@...>
> Subject: Re: [Cheetahtemplate-discuss] Having trouble with #include
> Reply-To: mso@...
>
> On Mon, Aug 04, 2003 at 10:53:43AM -0400, Aaron Buhr wrote:
> > However my first problem was that the variables were coming up
> undefined,
> > which from reading the archives is how the #include is supposed
> to work -
> > namespace not shared or some such.  So in my #included file I
> then copied
> > over my variable assignment (from a session var) from the
> including file,
>
> searchList variables should be visible automatically.  Use '#set global'
> instead of '#set' for other variables that should be visible in the
> included file.

	 I preferred to avoid set global because it's not thread-safe and because in
general global vars seem to be a bit sloppy programming practice.  However
if that's the simplest way I will do it.

	 I am unclear on why re-loading the variable from session state gave me the
Nonetype error though.  My original file (the including file) works fine and
looks more or less like this:
#extends CCGWeb_ServiceApp
#implements respond
#set $ValidPage1 = $IsValidPage1()
#set $serviceAppMsg = $self.session().value('serviceAppMsg', None)
#set $ssn = $self.session().value('ssn', None)

#if $ValidPage1
#include svcapp_page2
#else
There was an error with your data:<br>
$serviceAppMsg<br>
Click <a href="svcapp_page1">here</a> to try again.
<meta http-equiv="Refresh" content="0; URL=svcapp_page1">
#end if

	 The second file was just this:
#set $ssn = $self.session().value('ssn', None)
Testing:  $ssn

	 Is the file specified at #include supposed to be a Cheetah template file,
or is it supposed to be the compiled Cheetah .py file?  I just tried the .py
file and instead of the Nonetype not callable I get "Notfound: ssn".  FWIW
if I do use set global then it works when I #include the template file, but
excluding the #set line from the included file.  Are Cheetah directives not
allowed in included files?

	 Thanks for the help.



-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
Cheetahtemplate-discuss mailing list
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

#2211 From: Mike Orr <mso@...>
Date: Tue Aug 5, 2003 11:50 pm
Subject: Re: [Cheetahtemplate-discuss] Re: Having trouble with #include
mso@...
Send Email Send Email
 
On Tue, Aug 05, 2003 at 02:03:50PM -0400, Aaron Buhr wrote:
> > searchList variables should be visible automatically.  Use '#set global'
> > instead of '#set' for other variables that should be visible in the
> > included file.
>
>  I preferred to avoid set global because it's not thread-safe and because in
> general global vars seem to be a bit sloppy programming practice.  However
> if that's the simplest way I will do it.

#include is a mixed blessing.  The Cheetah developers rarely use it.
It mainly exists for unforeseen situations where it's necessary, like
yours is.

The biggest thing we wanted to prevent was people using
#include instead of $functions(), using global variables to pass data
in and out, and having the include file cause unexpected changes to the
parent's environment.  Overuse of #include is endemic in PHP and some
other languages, and we didn't want Cheetah to go that route.  That's
the reason '#set global' exists: to make it possible but inconvenient to
share non-searchList data, while making it loud and clear what you're
doing.

Your example shows that our compromises with #include cut both ways:
the same construct is good for some ppl but bad for others.  But at
least the construct allows ppl to do what they need somehow.

>  I am unclear on why re-loading the variable from session state gave me the
> Nonetype error though.  My original file (the including file) works fine and
> looks more or less like this:
> #extends CCGWeb_ServiceApp
> #implements respond
> #set $ValidPage1 = $IsValidPage1()
> #set $serviceAppMsg = $self.session().value('serviceAppMsg', None)
> #set $ssn = $self.session().value('ssn', None)
>
> #if $ValidPage1
> #include svcapp_page2
> #else
> There was an error with your data:<br>
> $serviceAppMsg<br>
> Click <a href="svcapp_page1">here</a> to try again.
> <meta http-equiv="Refresh" content="0; URL=svcapp_page1">
> #end if
>
>  The second file was just this:
> #set $ssn = $self.session().value('ssn', None)
> Testing:  $ssn
>
>  Is the file specified at #include supposed to be a Cheetah template file,
> or is it supposed to be the compiled Cheetah .py file?  I just tried the .py
> file and instead of the Nonetype not callable I get "Notfound: ssn".  FWIW
> if I do use set global then it works when I #include the template file, but
> excluding the #set line from the included file.  Are Cheetah directives not
> allowed in included files?

The included file should be Cheetah source.  ('#include raw' inserts the
content literally without interpretation.)  I'm not sure if it's possible
to include a compiled template module.

The reason you're getting None (if I understand
#include correctly) is that the include file is a separate template instance,
so it has a different 'self'.  Webware transaction info is not passed to
the second instance, so it acts like a standalone template.  We discovered
recently that $methods() also don't have access to the Webware transaction.
So your best choice is to '#set global' the data you need.

'#set global' is not thread safe for template instances, but each
thread can have its own instance.  We haven't found a lot of need to
reuse template instances since it takes no perceptable time to create
a new instance.  And with Webware, it's convenient to let Webware handle
servlet threading and not worry if the template is thread unsafe, because
it makes for much more convenient programming.

I usually receommend avoiding #include and instead using methods or
functions, especially if you need to pass data in and out.  If your
application has too many branches to do an 'if' switch, or you have to
calculate which method to call at runtime, that could be difficult, but
it's probably not insurmountable, and may lead to cleaner code than
using #include.

--
-Mike (Iron) Orr, mso@...  (iron@...)
    http://iron.cx/     English * Esperanto * Russkiy * Deutsch * Espan~ol


-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
Cheetahtemplate-discuss mailing list
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

#2212 From: Mike Orr <mso@...>
Date: Wed Aug 6, 2003 12:11 am
Subject: Re: [Cheetahtemplate-discuss] Re: Having trouble with #include
mso@...
Send Email Send Email
 
> On Tue, Aug 05, 2003 at 02:03:50PM -0400, Aaron Buhr wrote:
> > if I do use set global then it works when I #include the template file, but
> > excluding the #set line from the included file.  Are Cheetah directives not
> > allowed in included files?

The entire top-level template (outside any #def/#block) executes in a
method in the template instance -- normally .respond().  #set
creates/updates a local variable in that method.

The presence of #set also tells the Cheetah compiler that this variable
(in THIS method or include file) is local, so any $placeholder referring
to that variable is done as a local variable lookup (which is much
faster) rather than a searchList lookup.  This bypasses any '#set
global' value, because '#set global' is handled via the searchList.

#set is independent for each method or include file.  In any one it
appears, it makes lookups for that variable local.

--
-Mike (Iron) Orr, mso@...  (iron@...)
    http://iron.cx/     English * Esperanto * Russkiy * Deutsch * Espan~ol


-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
Cheetahtemplate-discuss mailing list
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

#2213 From: Hai-Chen Tu <hctu@...>
Date: Thu Aug 7, 2003 8:35 pm
Subject: [Cheetahtemplate-discuss] #Include issue
hctu@...
Send Email Send Email
 
Hi,
	 I am sorry to bring up this issue again but I feel that
	 it is nice to see this issue being resolved inside Cheetah
	 then by application developers. I apologize beforehand if
	 this issue has been resolved already and in such case
	 please let me know what is the solution.

	 The issue is that how Cheetah resolves file path for
		 #include "abc.txt"
	 or
		 t=Template(file="abc.txt")

	 Proposed application level solutions mentioned before
	 (the ones that I am aware of) are
		 1. the code spells out the complete path, or
		 2. by an application function (e.g., $include("abc.txt"));

	 I can think of several solutions inside Cheetah:

		 1. Use env variable
			 CHEETAH_TEMPLATE_DIR
		    and prefix file names that are not absolute.
		 2. Use env variable
			 CHEETAH_TEMPLATE_PATH
		    and search the first file (if the file name is
		    not absolute) matched the file name in the multi-dir path.
		 3. With or without 1/2, add functions to init/get/set a
			 global variable that control dir/path.

		 BTW, for backward compatibility, system should behave
		 like the current mechanism if 1/2/set are not used.

	 The coding shouldn't be too difficult (probably by modifying
	 Servlet.py:serverSidePath(...) and add init/set/get functions)
	 and I am sure it will benefit many users.

Hai-Chen Tu




-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
Cheetahtemplate-discuss mailing list
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

#2214 From: Yar3k <programisci_listy@...>
Date: Wed Aug 13, 2003 10:17 am
Subject: [Cheetahtemplate-discuss] type() does not work in tmpl?
programisci_listy@...
Send Email Send Email
 
I cannot use type() function in templates:

#echo type([1,2,3])
       or
#echo $type([1,2,3])
       or
$type([1,2,3])

displays nothing... Is it a bug?

I'm using WebKit 0.8.1 & Cheetah 0.9.15 & Apache 2.0.47/Win32



-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
Cheetahtemplate-discuss mailing list
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

#2215 From: Mike Orr <mso@...>
Date: Wed Aug 13, 2003 12:13 pm
Subject: Re: [Cheetahtemplate-discuss] type() does not work in tmpl?
mso@...
Send Email Send Email
 
On Wed, Aug 13, 2003 at 12:17:08PM +0200, Yar3k wrote:
> I cannot use type() function in templates:
>
> #echo type([1,2,3])
>       or
> #echo $type([1,2,3])
>       or
> $type([1,2,3])
>
> displays nothing... Is it a bug?
>
> I'm using WebKit 0.8.1 & Cheetah 0.9.15 & Apache 2.0.47/Win32

Type() puts <> around its output.  That looks like an unknown HTML tag
so the browser doesn't display it.  Put
	 #filter WebSafe
before it.

To return to the normal filter, if you care, put
	 #filter None

--
-Mike (Iron) Orr, mso@...  (iron@...)
    http://iron.cx/     English * Esperanto * Russkiy * Deutsch * Espan~ol


-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
Cheetahtemplate-discuss mailing list
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

#2216 From: Tavis Rudd <tavis@...>
Date: Wed Aug 13, 2003 8:17 pm
Subject: Re: [Cheetahtemplate-discuss] type() does not work in tmpl?
tavis@...
Send Email Send Email
 
On Wednesday 13 August 2003 03:17, Yar3k wrote:
> I cannot use type() function in templates:
>
> #echo type([1,2,3])
>       or
> #echo $type([1,2,3])
>       or
> $type([1,2,3])
>
> displays nothing... Is it a bug?
>
> I'm using WebKit 0.8.1 & Cheetah 0.9.15 & Apache 2.0.47/Win32

It works for me:

In [1]: from Cheetah.Template import Template

In [2]: print Template("""#echo type([1,2,3])
    ...:       or
    ...: #echo $type([1,2,3])
    ...:       or
    ...: $type([1,2,3])
    ...: """)
<type 'list'>
       or
<type 'list'>
       or
<type 'list'>

If you are trying this via HTML nothing will show up because <type 'list'>
will be interpreted by your browser as a bogus HTML tag which it will ignore.



-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
Cheetahtemplate-discuss mailing list
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

#2217 From: Jarosław Zabiełło <webmaster@...>
Date: Sat Aug 16, 2003 5:02 am
Subject: [Cheetahtemplate-discuss] $request does not work???
webmaster@...
Send Email Send Email
 
What is wrong with the following servlet?

from Cheetah.Template import Template
from WebKit.Page import Page
class MyServlet(Page):
     def awake(self, trans):
         Page.awake(self, trans)
     def writeContent(self):
         self.writeln(Template('test=$request.timestamp'))

I got:

File "D:\opt\PYTHON~1\lib\site-packages\Cheetah\NameMapper.py", line 197, in
valueForKey [edit]
     raise NotFound, key
NotFound: timeStamp

I am using Webware CVS and Cheetah CVS





-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
Cheetahtemplate-discuss mailing list
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

#2218 From: Mike Orr <mso@...>
Date: Sat Aug 16, 2003 6:48 am
Subject: Re: [Cheetahtemplate-discuss] $request does not work???
mso@...
Send Email Send Email
 
On Sat, Aug 16, 2003 at 07:02:19AM +0200, Jaros?aw Zabie??o wrote:
> What is wrong with the following servlet?
>
> from Cheetah.Template import Template
> from WebKit.Page import Page
> class MyServlet(Page):
>     def awake(self, trans):
>         Page.awake(self, trans)
>     def writeContent(self):
>         self.writeln(Template('test=$request.timestamp'))
>
> I got:
>
> File "D:\opt\PYTHON~1\lib\site-packages\Cheetah\NameMapper.py", line 197, in
valueForKey [edit]
>     raise NotFound, key
> NotFound: timeStamp

Did Cheetah really uppercase the 'S' in 'timeStamp'?  It should never do that.

Try replacing the template source string with this:

     #filter WebSafe
     $request

     $dir($request)

     $self.request

     $trans.request

     $searchList

All three 'request' variables should be the same, an instance of Webeware's
Request object.  $dir($request) will hopefully list the attributes and methods,
although it's not necessarily complete and differs in each Python version;
look for 'timestamp' and other Request methods.  If anything looks amiss, post
the result and we'll troubleshoot further.

--
-Mike (Iron) Orr, mso@...  (iron@...)
    http://iron.cx/     English * Esperanto * Russkiy * Deutsch * Espan~ol


-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
Cheetahtemplate-discuss mailing list
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

#2219 From: Jarosław Zabiełło <webmaster@...>
Date: Sat Aug 16, 2003 10:26 am
Subject: Re[2]: [Cheetahtemplate-discuss] $request does not work???
webmaster@...
Send Email Send Email
 
On Sat 16 VIII 2003 o godz. 08:48:02
Mike Orr <mso@...> wrote(a):

> Did Cheetah really uppercase the 'S' in 'timeStamp'?  It should never do that.

It's OK. The problem is: $request is None. Look at the following:

from Cheetah.Template import Template
from WebKit.Page import Page
class MyServlet(Page):
     def awake(self, trans):
         Page.awake(self, trans)
     def writeContent(self):
         self.writeln(Template('''
         #filter WebSafe
         request = $request
         dir(request) = $dir($request)
         self.request = $self.request
         searchlist = $searchList
         ##trans.request=$trans.request
         ''', searchList=[]))

Result:

request = None
dir(request) = ['__class__', '__delattr__', '__doc__', '__getattribute__',
'__hash__', '__init__', '__new__', '__reduce__', '__repr__', '__setattr__',
'__str__']
self.request = None
searchlist = [{}, <Cheetah.Template.Template instance at 0x00B958D8>]

Webware is missing???

I forgot to add. I am using Python v2.2.3.

--
JZ




-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
Cheetahtemplate-discuss mailing list
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

#2220 From: Jarosław Zabiełło <webmaster@...>
Date: Sat Aug 16, 2003 1:17 pm
Subject: [Cheetahtemplate-discuss] Re[3]: $request does not work???
webmaster@...
Send Email Send Email
 
The problem mentioned earlier does not appear in pure .tmpl file. (I
added CheetahServlet kit)

test.tmpl file:

#filter WebSafe
$request
$request.timeStamp

Output:

<WebKit.HTTPRequest.HTTPRequest instance at 0x01B6CA38>
Sat Aug 16 15:08:46 2003



BTW, $request.timestamp does NOT work.
Only $request.timeStamp works. :(



The same (except $request.timeStamp) from servlet:

from Cheetah.Template import Template
from WebKit.Page import Page
class MyServlet(Page):
     def awake(self, trans):
         Page.awake(self, trans)
     def writeContent(self):
         self.writeln(Template('''
         #filter WebSafe
         $request'''))

Output:

None

used: Webware CVS, Cheetah CVS

--
JZ




-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
Cheetahtemplate-discuss mailing list
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

#2221 From: Mike Orr <mso@...>
Date: Sat Aug 16, 2003 2:53 pm
Subject: Re: [Cheetahtemplate-discuss] Re[3]: $request does not work???
mso@...
Send Email Send Email
 
On Sat, Aug 16, 2003 at 03:17:17PM +0200, Jaros?aw Zabie??o wrote:
> test.tmpl file:
>
> #filter WebSafe
> $request
> $request.timeStamp

> from Cheetah.Template import Template
> from WebKit.Page import Page
> class MyServlet(Page):
>     def awake(self, trans):
>         Page.awake(self, trans)
>     def writeContent(self):
>         self.writeln(Template('''
>         #filter WebSafe
>         $request'''))

Ahhh!  Sometimes things can be so obvious that everyone misses them.  In the
first case, Webware call's the template's .respond() method directly, passing
it a live transaction object ('trans').  Cheetah connects self.request to
trans.request as a convenience, so $request referrs to a live request.

In the second case, the template is invoked in isolation.  Webware never calls
the template's .respond() directly so it doesn't pass the live transaction.
Cheetah substitutes a Cheetah.DummyTransaction instance, whose .request()
always returns None.  This propagates to self.request and $request as usual.

There are two ways around this:

1) Extract the specific requests values you need, and present them to the
    template via the searchList.

2) Put a 'request' variable directly into the searchList.

    self.writeln( Template(SOURCE_STRING, searchList=[{'request':
trans.request()}] )

    Since user searchList containers override 'self', your 'request' object will
    be used instead of the dummy.

By the way, the transaction data if available only to the top-level portion of
the template.  If you call a #def method or #include file, it's actually a
semi-independent subtemplate so the transaction info is not propagated.  The
easiest way to deal with this is to pass the specific values through via #def
arguments, or via '#set global' variables.

--
-Mike (Iron) Orr, mso@...  (iron@...)
    http://iron.cx/     English * Esperanto * Russkiy * Deutsch * Espan~ol


-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
Cheetahtemplate-discuss mailing list
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

#2222 From: Jarosław Zabiełło <webmaster@...>
Date: Sat Aug 16, 2003 3:38 pm
Subject: [Cheetahtemplate-discuss] Re[3]: $request does not work???
webmaster@...
Send Email Send Email
 
W Sat. 16 viii 2003 at 16:53:00
Mike Orr <mso@...> wrote:

> self.writeln( Template(SOURCE_STRING, searchList=[{'request':
trans.request()}] )

In my code "def writeContent(self)" has no trans variable. So I had to
use: self.writeln(Template(SOURCE_STRING, searchList=[{'request':
self.request()}])

(For a while it did not work correctly (eg. $request.timeStamp did not
work although $reqest.fields did). After downloading and installing
the latest Cheetach cvs this problem gone.)

> By the way, the transaction data if available only to the top-level
> portion of the template. If you call a #def method or #include file,
> it's actually a semi-independent subtemplate

I do not use #include at all. I changed my habits to use inherited
approach. It is much powerfull.

$request now works but... (I did not mention earlier) I still cannot
use shorter syntax: $request.field.myField. I have to use
request.field('myField'). $request.hasField.myField does not work
either (but $request.hasField('myField') works correct) Something was
changed in cvs version?

--
JZ





-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
Cheetahtemplate-discuss mailing list
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

#2223 From: Mike Orr <mso@...>
Date: Sat Aug 16, 2003 5:55 pm
Subject: Re: [Cheetahtemplate-discuss] Re[3]: $request does not work???
mso@...
Send Email Send Email
 
On Sat, Aug 16, 2003 at 05:38:42PM +0200, Jaros?aw Zabie??o wrote:
> $request now works but... (I did not mention earlier) I still cannot
> use shorter syntax: $request.field.myField. I have to use
> request.field('myField'). $request.hasField.myField does not work
> either (but $request.hasField('myField') works correct) Something was
> changed in cvs version?

I remember vaguely talking about this.  That's really a Webware design
issue.  I would have made .field a dictionary or pseudo-dictionary, but
Webware's BDFL felt strongly that .field should be a method.  Cheetah
won't translate $func.arg to $func('arg') because that would be
non-intuitive and error-prone.  Error-prone because it might happen when users
don't want it.  It's also incompatible with the much more useful
$func.attr -> $func().attr that many existing templates depend on.

However, you should be able to do $request.fields.myField, which translates
to $request.fields()['myField'] .

--
-Mike (Iron) Orr, mso@...  (iron@...)
    http://iron.cx/     English * Esperanto * Russkiy * Deutsch * Espan~ol


-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
Cheetahtemplate-discuss mailing list
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

#2224 From: Jarosław Zabiełło <webmaster@...>
Date: Sat Aug 23, 2003 6:26 am
Subject: [Cheetahtemplate-discuss] cache does not work :(
webmaster@...
Send Email Send Email
 
I do not know how to make WebKit & Cheetah to use cache. I am using
mod_webkit csv. CacheServletClasses and CacheServletInstances are set
to 1. My first try was:

TestCache.py:

import time
from WebKit.Page import Page
from Cheetah.Template import Template
class TestCache(Page):
     def writeHTML(self):
         t =  time.strftime('%H:%M:%S', time.localtime(time.time()))
         tmpl = Template(file='TestCache.tmpl', searchList=[{'t':t}])
         self.writeln(tmpl)

TestCache.tmpl:

<html>
<body>
#cache
t=$t
#end cache
</body>
</html>

But it does NOT work because every refresh of the page I get the new
values. It should be the same values if cache works, isn't it? I have
also tried another way:

TestCache.tmpl:

from WebKit.Page import Page
from Cheetah.Template import Template
class TestCache(Page):
     def writeHTML(self):
         tmpl = Template(file='TestCache.tmpl')
         self.writeln(tmpl)

TestCache.tmpl

<html>
<body>
#import time
#cache
#set $t =  time.strftime('%H:%M:%S', time.localtime(time.time()))
t=$t
#end cache
</body>
</html>

Unsuccesfull. :( Nothing was changed.What am I doing wrong??

--
JZ





-------------------------------------------------------
This SF.net email is sponsored by: VM Ware
With VMware you can run multiple operating systems on a single machine.
WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines
at the same time. Free trial click here:http://www.vmware.com/wl/offer/358/0
_______________________________________________
Cheetahtemplate-discuss mailing list
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

#2225 From: Tavis Rudd <tavis@...>
Date: Sat Aug 23, 2003 7:25 pm
Subject: Re: [Cheetahtemplate-discuss] cache does not work :(
tavis@...
Send Email Send Email
 
You're discarding the template object and recreating it for every request and
thus no caching can occur.  Here's how you should do it instead:

import time
from WebKit.Page import Page
from Cheetah.Template import Template
class TestCache(Page):
     def __init__(self):
         t =  time.strftime('%H:%M:%S', time.localtime(time.time()))
         self._tmpl = Template(file='TestCache.tmpl', searchList=[{'t':t}])

     def writeHTML(self):
         self.writeln(self._tmpl)



On Friday 22 August 2003 23:26, Jarosław Zabiełło wrote:
> I do not know how to make WebKit & Cheetah to use cache. I am using
> mod_webkit csv. CacheServletClasses and CacheServletInstances are set
> to 1. My first try was:
>
> TestCache.py:
>
> import time
> from WebKit.Page import Page
> from Cheetah.Template import Template
> class TestCache(Page):
>     def writeHTML(self):
>         t =  time.strftime('%H:%M:%S', time.localtime(time.time()))
>         tmpl = Template(file='TestCache.tmpl', searchList=[{'t':t}])
>         self.writeln(tmpl)
>
> TestCache.tmpl:
>
> <html>
> <body>
> #cache
> t=$t
> #end cache
> </body>
> </html>
>
> But it does NOT work because every refresh of the page I get the new
> values. It should be the same values if cache works, isn't it? I have
> also tried another way:
>
> TestCache.tmpl:
>
> from WebKit.Page import Page
> from Cheetah.Template import Template
> class TestCache(Page):
>     def writeHTML(self):
>         tmpl = Template(file='TestCache.tmpl')
>         self.writeln(tmpl)
>
> TestCache.tmpl
>
> <html>
> <body>
> #import time
> #cache
> #set $t =  time.strftime('%H:%M:%S', time.localtime(time.time()))
> t=$t
> #end cache
> </body>
> </html>
>
> Unsuccesfull. :( Nothing was changed.What am I doing wrong??



-------------------------------------------------------
This SF.net email is sponsored by: VM Ware
With VMware you can run multiple operating systems on a single machine.
WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines
at the same time. Free trial click here:http://www.vmware.com/wl/offer/358/0
_______________________________________________
Cheetahtemplate-discuss mailing list
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

#2226 From: Tavis Rudd <tavis@...>
Date: Sat Aug 23, 2003 7:30 pm
Subject: Re: [Cheetahtemplate-discuss] #Include issue
tavis@...
Send Email Send Email
 
Hi,
we've discussed this issue extensively in the past (see the archives) and
there are no plans to implement this as part of the internal workings of the
#include directive.  If anything, it's more likely that we'd deprecate and
eventually remove the #include directive (again see the archives for the
reasons why).
Cheers,
Tavis

On Thursday 07 August 2003 13:35, Hai-Chen Tu wrote:
> Hi,
>  I am sorry to bring up this issue again but I feel that
>  it is nice to see this issue being resolved inside Cheetah
>  then by application developers. I apologize beforehand if
>  this issue has been resolved already and in such case
>  please let me know what is the solution.
>
>  The issue is that how Cheetah resolves file path for
> 	 #include "abc.txt"
>  or
> 	 t=Template(file="abc.txt")
>
>  Proposed application level solutions mentioned before
>  (the ones that I am aware of) are
> 	 1. the code spells out the complete path, or
> 	 2. by an application function (e.g., $include("abc.txt"));
>
>  I can think of several solutions inside Cheetah:
>
> 	 1. Use env variable
> 		 CHEETAH_TEMPLATE_DIR
> 		   and prefix file names that are not absolute.
> 	 2. Use env variable
> 		 CHEETAH_TEMPLATE_PATH
> 		   and search the first file (if the file name is
> 		   not absolute) matched the file name in the multi-dir path.
> 	 3. With or without 1/2, add functions to init/get/set a
> 		 global variable that control dir/path.
>
> 	 BTW, for backward compatibility, system should behave
> 	 like the current mechanism if 1/2/set are not used.
>
>  The coding shouldn't be too difficult (probably by modifying
>  Servlet.py:serverSidePath(...) and add init/set/get functions)
>  and I am sure it will benefit many users.
>
> Hai-Chen Tu
>
>
>
>
> -------------------------------------------------------
> This SF.Net email sponsored by: Free pre-built ASP.NET sites including
> Data Reports, E-commerce, Portals, and Forums are available now.
> Download today and enter to win an XBOX or Visual Studio .NET.
> http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
> _______________________________________________
> Cheetahtemplate-discuss mailing list
> Cheetahtemplate-discuss@...
> https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss



-------------------------------------------------------
This SF.net email is sponsored by: VM Ware
With VMware you can run multiple operating systems on a single machine.
WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines
at the same time. Free trial click here:http://www.vmware.com/wl/offer/358/0
_______________________________________________
Cheetahtemplate-discuss mailing list
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

#2227 From: deelan <deelan@...>
Date: Thu Aug 28, 2003 9:37 am
Subject: [Cheetahtemplate-discuss] Weird behavior on $items
deelan@...
Send Email Send Email
 
hi all,

yesterday i was using cheetah to generate a static HTML page
from an RSS feed  and i stumbled upon this weird bahavior of the
template engine, i've a reduced testcase to show the problem, please
copy/paste:

# begin ----------------------------------------

from Cheetah.Template import Template

tmpl = """
#for $item in $items
    ($item.date), $item.link, $item.title
#end for
"""

items = [{'title':'abc', 'link':'http://someurl.com', 'date':'15jan2003'}]

namespace = {'items': items}
t = Template(tmpl, searchList=[namespace])

print t # output is empty

# end ------------------------------------------

on my system the script prints nothing. i'm not
sure what's the problem, maybe cheetah autocall
does the wrong guess on that $items variable, maybe
it calls dict's .items() method?

to make the script working i need to change $items
to $feed in the template string and the namespace
accordingly:
namespace = {'feed': items}

can someone explain me what's wrong with my code?

i'm using python2.3 on win2k SP4.

TIA



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Cheetahtemplate-discuss mailing list
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

#2228 From: "Tracy S. Ruggles" <tracy@...>
Date: Thu Aug 28, 2003 12:57 pm
Subject: Re: [Cheetahtemplate-discuss] Weird behavior on $items
tracy@...
Send Email Send Email
 
Same result for me (0.9.15) -- and I get an empty list when I do this:

	 >>> print Template('$items')
	 []

I think it's printing the 'items' from the empty dictionary in the
search list since it shows up before the 'items' in your own search
list:

	 >>> print Template('$items --> $SL', searchList=[{'items':'huh?'}])
	 [] --> [{}, {'items': 'huh?'}, <Cheetah.Template.Template instance at
0x7c9890>]

--T

On Thursday, August 28, 2003, at 04:37 AM, deelan wrote:

> hi all,
>
> yesterday i was using cheetah to generate a static HTML page
> from an RSS feed  and i stumbled upon this weird bahavior of the
> template engine, i've a reduced testcase to show the problem, please
> copy/paste:
>
> # begin ----------------------------------------
>
> from Cheetah.Template import Template
>
> tmpl = """
> #for $item in $items
>   ($item.date), $item.link, $item.title
> #end for
> """
>
> items = [{'title':'abc', 'link':'http://someurl.com',
> 'date':'15jan2003'}]
>
> namespace = {'items': items}
> t = Template(tmpl, searchList=[namespace])
>
> print t # output is empty
>
> # end ------------------------------------------
>
> on my system the script prints nothing. i'm not
> sure what's the problem, maybe cheetah autocall
> does the wrong guess on that $items variable, maybe
> it calls dict's .items() method?
>
> to make the script working i need to change $items
> to $feed in the template string and the namespace
> accordingly:
> namespace = {'feed': items}
>
> can someone explain me what's wrong with my code?
>
> i'm using python2.3 on win2k SP4.
>
> TIA
>
>
>
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> Cheetahtemplate-discuss mailing list
> Cheetahtemplate-discuss@...
> https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
>



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Cheetahtemplate-discuss mailing list
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

#2229 From: Mike Orr <mso@...>
Date: Thu Aug 28, 2003 1:57 pm
Subject: Re: [Cheetahtemplate-discuss] Weird behavior on $items
mso@...
Send Email Send Email
 
On Thu, Aug 28, 2003 at 07:57:17AM -0500, Tracy S. Ruggles wrote:
> Same result for me (0.9.15) -- and I get an empty list when I do this:
>
>  >>> print Template('$items')
>  []
>
> I think it's printing the 'items' from the empty dictionary in the
> search list since it shows up before the 'items' in your own search
> list:
>
>  >>> print Template('$items --> $SL', searchList=[{'items':'huh?'}])
>  [] --> [{}, {'items': 'huh?'}, <Cheetah.Template.Template instance
>  at 0x7c9890>]

Tada!  The long-standing dict method bug, first discovered by Edmund,
strikes again.  Tavis and I separately rewrote NameMapper to overcome
it, then he got busy with work and a final version never got finished.

The workaround until then is to avoid names corresponding to dictionary
methods.

The empty dictionary is the '#set globals' dictionary.

--
-Mike (Iron) Orr, mso@...  (iron@...)
    http://iron.cx/     English * Esperanto * Russkiy * Deutsch * Espan~ol


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Cheetahtemplate-discuss mailing list
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

#2230 From: Edmund Lian <elian@...>
Date: Thu Aug 28, 2003 3:18 pm
Subject: Re: [Cheetahtemplate-discuss] Weird behavior on $items
elian@...
Send Email Send Email
 
Mike Orr wrote:

> Tada!  The long-standing dict method bug, first discovered by Edmund,
> strikes again.  Tavis and I separately rewrote NameMapper to overcome
> it, then he got busy with work and a final version never got finished.
>
> The workaround until then is to avoid names corresponding to dictionary
> methods.

Yup, sure is. I believe there was a fix to the Python version of the
Namemapper, but this was removed when Tavis didn't have time to fix the
C version.

...Edmund.



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Cheetahtemplate-discuss mailing list
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

#2231 From: deelan <deelan@...>
Date: Thu Aug 28, 2003 6:02 pm
Subject: Re: [Cheetahtemplate-discuss] Weird behavior on $items
deelan@...
Send Email Send Email
 
Mike Orr wrote:
(...)
> Tada!  The long-standing dict method bug, first discovered by Edmund,
> strikes again.  Tavis and I separately rewrote NameMapper to overcome
> it, then he got busy with work and a final version never got finished.

> The workaround until then is to avoid names corresponding to dictionary
> methods.
  > The empty dictionary is the '#set globals' dictionary.

ahhh, ok, now i got it. thanks for
the explanation. hope it will be fixed,
sooner or later. :)

later,
deelan






-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Cheetahtemplate-discuss mailing list
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

#2232 From: <rtjohan@...>
Date: Thu Aug 28, 2003 8:01 pm
Subject: [Cheetahtemplate-discuss] Cheetah + Spyce / Cheetah template examples
rtjohan@...
Send Email Send Email
 
Anyone using Cheetah with Spyce?

Are there any good Cheetah examples?
Even better if example shows how Cheetah is best used for large
applications?

Thanks,
Richard




-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Cheetahtemplate-discuss mailing list
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

#2233 From: Guenther Starnberger <gst@...>
Date: Mon Sep 1, 2003 1:02 pm
Subject: [Cheetahtemplate-discuss] debianized cheetahtemplate
gst@...
Send Email Send Email
 
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

hello,

i created a cheetahtemplate debian package for my private use and thought that
you may be interested in including the required changes into the main
distribution. (the only change would be a new subdirectory (including some
files) called 'debian' which gives debian users the possibility to
automatically create binary packages by calling the 'dpkg-buildpackage'
command).

i'm not a debian developer nor did i create any debian packages before, so
it's possibile that there are some bugs, etc. - it works well on my system.
the only small problem i noticed is that the cheetahtemplate packages for
different python versions conflict, because they share the same files in
/usr/bin/ (e.g. 'cheetah-compile').

the required files are available at
http://s2.enemy.org/~gst/misc/cheetah-debian.tar.gz - to create debian
packages the 'debian' directory has to be moved into the root directory of
the cheetahtemplate distribution.

binary packages are created for following python versions: 2.1, 2.2, 2.3
i only tested it on debian testing/unstable. to create debian woody packages
the only required change should be to disable the creation of a binary
package for python 2.3.

cu
/gst
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQE/U0NdZtF7I/+gjcERAmcWAJ4gKdPYYKNEVItfUfroS/aXDD4NqwCeMTV0
3n8FeBrLj58UyUxJwL64/l4=
=MEZK
-----END PGP SIGNATURE-----



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Cheetahtemplate-discuss mailing list
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

#2234 From: Simon Willison <cs1spw@...>
Date: Thu Sep 11, 2003 4:19 pm
Subject: [Cheetahtemplate-discuss] #include default directory
cs1spw@...
Send Email Send Email
 
Hi all,

I'm new to Cheetah, and I'm having fun exploring its capabilities. I've
just started experimenting with the #include directive. At the moment,
I'm having to specify the full filesystem path to each included file. Is
there a way of setting a 'default' includes directory, or (even better)
setting Cheetah up so that included files are specified relative to the
directory that contains the Cheetah template file doing the including?

Thanks,

Simon Willison
http://simon.incutio.com/



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Cheetahtemplate-discuss mailing list
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

#2235 From: rtjohan@...
Date: Thu Sep 11, 2003 8:24 pm
Subject: [Cheetahtemplate-discuss] PSP / Cheetah for webware - key strengths, actively developed? (Cast your vote)
rtjohan@...
Send Email Send Email
 
Is there any estimate in how many people are using either PSP or Cheetah?

Is PSP or Cheetah being actively developed?

Is PSP and Cheetah pretty much interchangeable or is each better suited
for certain type of website or development environment?

For a large dynamic site which would you recommend?

Thanks,
Richard



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Cheetahtemplate-discuss mailing list
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

#2236 From: Mike Orr <mso@...>
Date: Fri Sep 12, 2003 12:11 am
Subject: Re: [Cheetahtemplate-discuss] #include default directory
mso@...
Send Email Send Email
 
On Thu, Sep 11, 2003 at 05:19:34PM +0100, Simon Willison wrote:
> I'm new to Cheetah, and I'm having fun exploring its capabilities. I've
> just started experimenting with the #include directive. At the moment,
> I'm having to specify the full filesystem path to each included file. Is
> there a way of setting a 'default' includes directory, or (even better)
> setting Cheetah up so that included files are specified relative to the
> directory that contains the Cheetah template file doing the including?

You have to specify the full path if Cheetah's notion of the current
directory doesn't match your needs.  A few others have requested an
include path, but Cheetah's developers think #include should be used
sparingly, so we aren't planning any enhancements to it.  Usually one
can substitute a method or function for #include, which better control
the arguments and return values.

If this is a hardship, you can post a specific example on the list, and
we'll be happy to offer suggestions.

--
-Mike (Iron) Orr, mso@...  (iron@...)
    http://iron.cx/     English * Esperanto * Russkiy * Deutsch * Espan~ol


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Cheetahtemplate-discuss mailing list
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

#2237 From: Mike Orr <mso@...>
Date: Fri Sep 12, 2003 12:25 am
Subject: Re: [Cheetahtemplate-discuss] PSP / Cheetah for webware - key strengths, actively developed? (Cast your vote)
mso@...
Send Email Send Email
 
On Thu, Sep 11, 2003 at 01:24:17PM -0700, rtjohan@... wrote:
> Is there any estimate in how many people are using either PSP or Cheetah?

Not that I know of.  SourceForce may have download statistics somewhere,
which would give a minimum estimate.

> Is PSP or Cheetah being actively developed?

Cheetah is being actively developed, although slowly.  Urgent bugs are
fixed immediately, minor bugs and enhancements are fixed when the
developers have time.  I don't know about PSP.

> Is PSP and Cheetah pretty much interchangeable or is each better suited
> for certain type of website or development environment?

It's mainly a stylistic preference.  Some developers like ASP/PHP's
embedded-command stype; others prefer templates.  Cheetah has several
performance features -- compilation, caching, etc -- which give it an
advantage in high-load situations.  Cheetah templates can be used either
as servlets (analagous to PSP) or can be created/invoked from Python
code within a function; I'm not sure if PSP can do the latter.

> For a large dynamic site which would you recommend?

I find Cheetah templates easier to maintain, and it also has the
performance advantages mentioned above.  But I'm biased.

--
-Mike (Iron) Orr, mso@...  (iron@...)
    http://iron.cx/     English * Esperanto * Russkiy * Deutsch * Espan~ol


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Cheetahtemplate-discuss mailing list
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

Messages 2208 - 2237 of 5012   Oldest  |  < Older  |  Newer >  |  Newest
Add to My Yahoo!      XML What's This?

Copyright © 2010 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines NEW - Help