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...
Message search is now enhanced, find messages faster. Take it for a spin.

Messages

Advanced
Messages Help
Messages 4070 - 4099 of 5012   Oldest  |  < Older  |  Newer >  |  Newest
Messages: Show Message Summaries Sort by Date ^  
#4070 From: "Jeff Hinrichs - DM&T" <jeffh@...>
Date: Mon May 7, 2007 2:22 am
Subject: [Cheetahtemplate-discuss] testing for list membership with "in"
jeffh@...
Send Email Send Email
 
#set $groups = ['red','blue','green']
#if 'red' in $groups
#    set $foo = "found"
#else
#    set $foo = "not found"
#end if

$foo

results in the error:

  NotFound: cannot find 'foo'

So what idiom is used to test if a value exists in a list, with cheetah?

thanks,

--
Jeff Hinrichs
http://www.OmahaPython.org

-------------------------------------------------------------------------
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
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

#4071 From: "Mike Orr" <sluggoster@...>
Date: Mon May 7, 2007 6:33 am
Subject: Re: [Cheetahtemplate-discuss] testing for list membership with "in"
sluggoster@...
Send Email Send Email
 
On 5/6/07, Jeff Hinrichs - DM&T <jeffh@...> wrote:
> #set $groups = ['red','blue','green']
> #if 'red' in $groups
> #    set $foo = "found"
> #else
> #    set $foo = "not found"
> #end if
>
> $foo
>
> results in the error:
>
>  NotFound: cannot find 'foo'
>
> So what idiom is used to test if a value exists in a list, with cheetah?

The problem is the spaces before 'set'.  Cheetah thinks it's text
rather than a directive.

--
Mike Orr <sluggoster@...>

-------------------------------------------------------------------------
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
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

#4072 From: "Jeff Hinrichs - DM&T" <jeffh@...>
Date: Mon May 7, 2007 12:29 pm
Subject: Re: [Cheetahtemplate-discuss] testing for list membership with "in"
jeffh@...
Send Email Send Email
 
On 5/7/07, Mike Orr <sluggoster@...> wrote:
> On 5/6/07, Jeff Hinrichs - DM&T <jeffh@...> wrote:
> > #set $groups = ['red','blue','green']
> > #if 'red' in $groups
> > #    set $foo = "found"
> > #else
> > #    set $foo = "not found"
> > #end if
> >
> > $foo
> >
> > results in the error:
> >
> >  NotFound: cannot find 'foo'
> >
> > So what idiom is used to test if a value exists in a list, with cheetah?
>
> The problem is the spaces before 'set'.  Cheetah thinks it's text
> rather than a directive.
>
> --
> Mike Orr <sluggoster@...>
>

Thanks - that was exactly my problem.

Are there any standard idioms for handling checkboxes/option groups
with cheetah?

Thanks,

Jeff

-------------------------------------------------------------------------
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
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

#4073 From: "Mike Orr" <sluggoster@...>
Date: Mon May 7, 2007 3:36 pm
Subject: Re: [Cheetahtemplate-discuss] testing for list membership with "in"
sluggoster@...
Send Email Send Email
 
On 5/7/07, Jeff Hinrichs - DM&T <jeffh@...> wrote:
> On 5/7/07, Mike Orr <sluggoster@...> wrote:
> > On 5/6/07, Jeff Hinrichs - DM&T <jeffh@...> wrote:
> > > #set $groups = ['red','blue','green']
> > > #if 'red' in $groups
> > > #    set $foo = "found"
> > > #else
> > > #    set $foo = "not found"
> > > #end if
> > >
> > > $foo
> > >
> > > results in the error:
> > >
> > >  NotFound: cannot find 'foo'
> > >
> > > So what idiom is used to test if a value exists in a list, with cheetah?
> >
> > The problem is the spaces before 'set'.  Cheetah thinks it's text
> > rather than a directive.

Not that I can think of.  #def, #if, and one-line if may be useful.  I
use Quixote's form library, and am about to try ToscaWidgets.

--
Mike Orr <sluggoster@...>

-------------------------------------------------------------------------
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
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

#4074 From: ro <rosettas@...>
Date: Wed May 9, 2007 2:08 am
Subject: [Cheetahtemplate-discuss] how to do if a parameter is not existed
rosettas@...
Send Email Send Email
 
hi all

I want to make a template can accept a parameter is not exist.
If the parameter is not exist then leave blank, and if there is that
parameter then use the parameter.

I have tried this code:
<textarea name="t2name" size="50">#try
$name
#except
#silent ''
#end try
</textarea>

It worked, but it will leave a "return" that is not I needed in the <textarea>.

Is there any method resolved this problem?

--
with kind regards

-------------------------------------------------------------------------
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
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

#4075 From: "Jeff Hinrichs - DM&T" <jeffh@...>
Date: Wed May 9, 2007 2:50 am
Subject: Re: [Cheetahtemplate-discuss] how to do if a parameter is not existed
jeffh@...
Send Email Send Email
 
have you tried #slurp
?
http://www.cheetahtemplate.org/docs/users_guide_html/users_guide.html#SECTION000\
870000000000000000

-j

On 5/8/07, ro <rosettas@...> wrote:
> hi all
>
> I want to make a template can accept a parameter is not exist.
> If the parameter is not exist then leave blank, and if there is that
> parameter then use the parameter.
>
> I have tried this code:
> <textarea name="t2name" size="50">#try
> $name
> #except
> #silent ''
> #end try
> </textarea>
>
> It worked, but it will leave a "return" that is not I needed in the
<textarea>.
>
> Is there any method resolved this problem?
>
> --
> with kind regards
>
> -------------------------------------------------------------------------
> 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
> Cheetahtemplate-discuss@...
> https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
>


--
Jeff Hinrichs
Dundee Media & Technology, Inc
jeffh@...
402.320.0821

-------------------------------------------------------------------------
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
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

#4076 From: "Jeff Hinrichs - DM&T" <jeffh@...>
Date: Wed May 9, 2007 3:15 am
Subject: [Cheetahtemplate-discuss] HiddenField not so much in a tableDump
jeffh@...
Send Email Send Email
 
In a tableDump, a HiddenField's name is used as it's label in the
table.  This makes it not so hidden.  I've got an idea to add a
"isHidden(): return True" method to the HiddenField class just like
the isButton() .  Then it's just a simple matter of outputting the
HiddenField outside of the table elements.

I see a note in the code about possibly caching hidden fields and
outputting them last (in the future).  I would suggest just the
opposite, process them first putting them before the table start.
There is a reason for this -- displaying a not directly editable value
to a user.  Show them the info in a "disabled' text box but also send
the info as a hidden field of the same name.  The form doesn't return
the value in the disabled field (like a record id) or some other
calculated information but it is returned by the hidden field of the
same name.

algo:
  process list of fields handling hidden fields
  process list of fields using current method, skipping hidden fields

I'd be happy to submit a patch(svn) -- or at least the changes(cvs) or
if your svn repos not public.


I'm using FK with mod_python and vampire with good luck and I'd be
happy to write up a small how to.


-Jeff
http://www.OmahaPython.org

-------------------------------------------------------------------------
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
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

#4077 From: "Jeff Hinrichs - DM&T" <jeffh@...>
Date: Wed May 9, 2007 3:17 am
Subject: Re: [Cheetahtemplate-discuss] how to do if a parameter is not existed
jeffh@...
Send Email Send Email
 
On 5/8/07, ro <rosettas@...> wrote:
> On 5/9/07, Jeff Hinrichs - DM&T <jeffh@...> wrote:
> > have you tried #slurp
> > ?
> >
http://www.cheetahtemplate.org/docs/users_guide_html/users_guide.html#SECTION000\
870000000000000000
> >
>
> Yes, thank you, it works
>
> $name #slurp
>
> But it is not pefect:) Users must add #try and #slurp every parameters
>
>
> --
> with kind regards
>
I'm a cheetah noob so there might very well be a better way - but that
was the only thing outside of mods to your controller code.

cheers

-------------------------------------------------------------------------
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
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

#4078 From: "Jeff Hinrichs - DM&T" <jeffh@...>
Date: Wed May 9, 2007 12:10 pm
Subject: [Cheetahtemplate-discuss] Fwd: HiddenField not so much in a tableDump
jeffh@...
Send Email Send Email
 
---------- Forwarded message ----------
From: Jeff Hinrichs - DM&T <jeffh@...>
Date: May 8, 2007 10:15 PM
Subject: HiddenField not so much in a tableDump
To: cheetahtemplate-discuss@...


In a tableDump, a HiddenField's name is used as it's label in the
table.  This makes it not so hidden.  I've got an idea to add a
"isHidden(): return True" method to the HiddenField class just like

apologies - I mis-directed this post to the wrong group.

-j

-------------------------------------------------------------------------
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
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

#4079 From: James Robinson <jlrobins@...>
Date: Thu May 10, 2007 4:07 pm
Subject: [Cheetahtemplate-discuss] Dynamically compiled cheetah classes vs. garbage collection
jlrobins@...
Send Email Send Email
 
First off -- hats off to Cheetah, the tried and true workhorse of
Python template engines. We've used Cheetah for 4 years now, rendering:

	 * /etc/hosts
	 * BIND zone files
	 * /etc/passwd
	 * /etc/aliases
	 * Makefiles
	 * Java source code
	 * Python source code
	 * and of course XHTML as embedded in FastCGIs.

Having a non-HTML/XHTML centric templating engine lets us leverage it
for most all of our textfile rendering needs. Soon to be added to
that list will be Asterisk extension and voicemail configs.

But back to our web-environment. We host a lot of virtual domains,
and right now our web publishing framework is not vhost-aware -- each
fastcgi instance is for a specific vhost with a distinct set of pages
-- precompiled templates loaded via import.

On our development machines, in order to speed up compile / edit /
debug, we also support driving Cheetah compiler on the fly via:

	 template_source = open(fullpath, 'r').read()
	 clazz = Template.compile(template_source)

In order to save memory on the fastcgi server machines, since the
majority of the vhosts are idle most of the time and most of our
server traffic is to our primary domain virtual host, we're going to
teach the fastcgi processes how to be vhost aware. But if they end up
import-ing all of the templates from all of the vhosts, then the
memory usage just for the template classes could be rather vast.

So, the real question is, if we also switch to using open() /
Template.compile() and, say, a LRU cache of compiled templates, then
when our userspace python code drops the last reference to a compiled
template, would / could CPython free up the memory that the template
class / module was using? Or am I dreaming?

Thanks,
James

----
James Robinson
Socialserve.com


-------------------------------------------------------------------------
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
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

#4080 From: Yannick Gingras <ygingras@...>
Date: Fri May 11, 2007 6:49 am
Subject: [Cheetahtemplate-discuss] Caching and TurboCheetah
ygingras@...
Send Email Send Email
 
Hi,
   I'm having a hard time getting caching to work with TurboCheetah on
Debian Etch.  Hi have no problem to get caching to work on a
standalone Python application though.  TurboGears and Cheetah are
apt-get installed from the Etch repository and TurboCheetah was
easy_installed.  I can reproduce the problem like that:

   tg-admin quickstart  cheetahdemo

I put

   class Root(controllers.RootController):
       @expose(template="cheetah:cheetahdemo.templates.foo")
       def index(self):
           import time
           return dict(now=time.ctime())

in controllers.py and my foo template is

   We are now $*30*now.

Whenever I hit my browser's refresh button, the time is updated.  If I
type at the Python shell something like:

   t = Template.Template("We are now $*5*now.")
   t.now = datetime.datetime.now
   print t
   # ...
   print t

I do get the expected behavior, t is refreshed only after 5 minutes.

I like the caching system in Cheetah and event though I could roll my
own (and I did in fact implemented a limited replacement using the
database), the smartest move would be to get it to work.  Anyone know
if it is possible to enable caching in TurboCheetah?

Best regards,

--
Yannick Gingras


-------------------------------------------------------------------------
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
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

#4081 From: Tavis Rudd <tavis@...>
Date: Fri May 11, 2007 7:08 pm
Subject: Re: [Cheetahtemplate-discuss] Caching and TurboCheetah
tavis@...
Send Email Send Email
 
I've never used TurboCheetah, but I suspect it's recompiling or
reinstantiating a new instance of that template for every request.
Caching only works if the same instance is used for each request.

On Fri, 11 May 2007, Yannick Gingras wrote:

>
> Hi,
>  I'm having a hard time getting caching to work with TurboCheetah on
> Debian Etch.  Hi have no problem to get caching to work on a
> standalone Python application though.  TurboGears and Cheetah are
> apt-get installed from the Etch repository and TurboCheetah was
> easy_installed.  I can reproduce the problem like that:
>
>  tg-admin quickstart  cheetahdemo
>
> I put
>
>  class Root(controllers.RootController):
>      @expose(template="cheetah:cheetahdemo.templates.foo")
>      def index(self):
>          import time
>          return dict(now=time.ctime())
>
> in controllers.py and my foo template is
>
>  We are now $*30*now.
>
> Whenever I hit my browser's refresh button, the time is updated.  If I
> type at the Python shell something like:
>
>  t = Template.Template("We are now $*5*now.")
>  t.now = datetime.datetime.now
>  print t
>  # ...
>  print t
>
> I do get the expected behavior, t is refreshed only after 5 minutes.
>
> I like the caching system in Cheetah and event though I could roll my
> own (and I did in fact implemented a limited replacement using the
> database), the smartest move would be to get it to work.  Anyone know
> if it is possible to enable caching in TurboCheetah?
>
> Best regards,
>
> --
> Yannick Gingras
>
>
> -------------------------------------------------------------------------
> 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
> Cheetahtemplate-discuss@...
> https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
>

-------------------------------------------------------------------------
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
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

#4082 From: Yannick Gingras <ygingras@...>
Date: Fri May 11, 2007 8:10 pm
Subject: Re: [Cheetahtemplate-discuss] Caching and TurboCheetah
ygingras@...
Send Email Send Email
 
Tavis Rudd <tavis@...> writes:

> I've never used TurboCheetah, but I suspect it's recompiling or
> reinstantiating a new instance of that template for every
> request. Caching only works if the same instance is used for each
> request.

I feared something like this.  Should I check with the TurboGears
folks?  Otherwise, what are my options?  Can I specify a singleton
class inside the template itself?  I'm pretty sure that CherryPy, the
app server under TurboGears, runs under a single Python instance.  But,
while we are talking about the possibility of more than one Python
process, is there a facility built-in to use remote memcached or anything
like that?

I confess that I really don't need anything of that scale yet but I
do, prematurely obviously, envision the kind of setup I would deploy
when I'll have the great fortune of seeing my single threaded app
collapse under a torrent of visitors.

--
Yannick Gingras


-------------------------------------------------------------------------
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
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

#4083 From: "Mike Orr" <sluggoster@...>
Date: Fri May 11, 2007 8:55 pm
Subject: Re: [Cheetahtemplate-discuss] Caching and TurboCheetah
sluggoster@...
Send Email Send Email
 
On 5/11/07, Yannick Gingras <ygingras@...> wrote:
> Tavis Rudd <tavis@...> writes:
>
> > I've never used TurboCheetah, but I suspect it's recompiling or
> > reinstantiating a new instance of that template for every
> > request. Caching only works if the same instance is used for each
> > request.
>
> I feared something like this.  Should I check with the TurboGears
> folks?  Otherwise, what are my options?  Can I specify a singleton
> class inside the template itself?  I'm pretty sure that CherryPy, the
> app server under TurboGears, runs under a single Python instance.  But,
> while we are talking about the possibility of more than one Python
> process, is there a facility built-in to use remote memcached or anything
> like that?
>
> I confess that I really don't need anything of that scale yet but I
> do, prematurely obviously, envision the kind of setup I would deploy
> when I'll have the great fortune of seeing my single threaded app
> collapse under a torrent of visitors.

TurboCheetah does not reuse template instances.  It recompiles the
template each time.  If you pass the "cheetah.precompiled" option, it
imports a .py template module instead.  Neither of these will help in
your case.

Caching template instances in a web framework would take some careful
Cheetah-specific thinking.  You'd have to lock the instance so another
thread can't access it while you set the placeholder values and fill
the template.  (See Python's mutex module for a locking strategy.)
You can set the values via 'self' attributes or -- probably better --
put a dict in the search list and keep a separate reference to it so
you can modify the dict in place.  This is all too specific for a
general-purpose tool like TurboCheetah, though you could make a custom
version of TurboCheetah that did it.

--
Mike Orr <sluggoster@...>

-------------------------------------------------------------------------
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
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

#4084 From: Yannick Gingras <ygingras@...>
Date: Sat May 12, 2007 3:58 am
Subject: [Cheetahtemplate-discuss] Cheetah + Unicode: default encoding?
ygingras@...
Send Email Send Email
 
In the doc, I found how to specify the encoding the literals in my
templates (#ecoding) but I didn't find a way to specify the encoding
to use to convert unicode fields.  At the moment, I do something like

   Your hotel will be ${hotel.name.encode("utf-8")}.

But somehow I find it ugly and unproductive.  If I ever decide to
change a string to unicode in my data model, I have a lot of hunting
to do and nothing will break until I use that field with actual
unicode.  I will also have problems if I ever want to use another
encoding though I admit I really don't see a case were UTF-8 is not
the best choice.  Latin-1 is a tiny bit more compact for french but I
wouldn't advise someone to use it.

Is there an elegant way to tell Cheetah to encode all my unicode
objects in UTF-8?

--
Yannick Gingras


-------------------------------------------------------------------------
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
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

#4085 From: Eljakim Schrijvers <eschrijvers@...>
Date: Sat May 12, 2007 6:54 am
Subject: [Cheetahtemplate-discuss] Installation problem on OS X
eschrijvers@...
Send Email Send Email
 
Hi there,

I just installed the latest cheetah release on my MacBook OS X
laptop. The
cheetah program breaks when I run it.

Here is the data on my python environment:
mathilde:/Users/eljakim/Desktop/Cheetah-2.0rc8: python
Python 2.5 (r25:51918, Sep 19 2006, 08:49:13)
[GCC 4.0.1 (Apple Computer, Inc. build 5341)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
  >>> quit()

Here is the traceback when I run the program:

mathilde:/Users/eljakim/Desktop/Cheetah-2.0rc8: cheetah test
Traceback (most recent call last):
    File "/Library/Frameworks/Python.framework/Versions/Current/bin/
cheetah", line 2, in <module>
      from Cheetah.CheetahWrapper import CheetahWrapper
    File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/Cheetah-1.0-py2.5-macosx-10.3-fat.egg/Cheetah/
CheetahWrapper.py", line 23, in <module>
      from Cheetah.Compiler import Compiler
    File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/Cheetah-1.0-py2.5-macosx-10.3-fat.egg/Cheetah/
Compiler.py", line 33, in <module>
      from Cheetah.Parser import Parser, ParseError, specialVarRE,
STATIC_CACHE, REFRESH_CACHE
    File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/Cheetah-1.0-py2.5-macosx-10.3-fat.egg/Cheetah/
Parser.py", line 32, in <module>
      from Cheetah import ErrorCatchers
    File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/Cheetah-1.0-py2.5-macosx-10.3-fat.egg/Cheetah/
ErrorCatchers.py", line 16, in <module>
      from Cheetah.NameMapper import NotFound
    File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/Cheetah-1.0-py2.5-macosx-10.3-fat.egg/Cheetah/
NameMapper.py", line 146
      from __future__ import generators
SyntaxError: from __future__ imports must occur at the beginning of
the file
mathilde:/Users/eljakim/Desktop/Cheetah-2.0rc8:

I fixed it by moving the
      from __future__ import generators
three lines up.

I had to do the same for the test for NameMapper.

Would this be something that needs fixing in the default install?

Eljakim


-------------------------------------------------------------------------
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
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

#4086 From: Tavis Rudd <tavis@...>
Date: Sat May 12, 2007 6:37 pm
Subject: Re: [Cheetahtemplate-discuss] Installation problem on OS X
tavis@...
Send Email Send Email
 
Hi Eljakim,
You seem to have a weird installation issue where setuptools
(easy_install, etc.) has a copy of Cheetah-1.0 sitting in your PYTHONPATH
and it is being imported instead of 2.0rc8.  Have a look at the file paths
in your traceback and you'll see what I mean.  Remove that and Cheetah
2.0rc8 will start working.
Cheers,
Tavis

On Sat, 12 May 2007, Eljakim Schrijvers wrote:

> Hi there,
>
> I just installed the latest cheetah release on my MacBook OS X
> laptop. The
> cheetah program breaks when I run it.
>
> Here is the data on my python environment:
> mathilde:/Users/eljakim/Desktop/Cheetah-2.0rc8: python
> Python 2.5 (r25:51918, Sep 19 2006, 08:49:13)
> [GCC 4.0.1 (Apple Computer, Inc. build 5341)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
> >>> quit()
>
> Here is the traceback when I run the program:
>
> mathilde:/Users/eljakim/Desktop/Cheetah-2.0rc8: cheetah test
> Traceback (most recent call last):
>   File "/Library/Frameworks/Python.framework/Versions/Current/bin/
> cheetah", line 2, in <module>
>     from Cheetah.CheetahWrapper import CheetahWrapper
>   File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
> python2.5/site-packages/Cheetah-1.0-py2.5-macosx-10.3-fat.egg/Cheetah/
> CheetahWrapper.py", line 23, in <module>
>     from Cheetah.Compiler import Compiler
>   File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
> python2.5/site-packages/Cheetah-1.0-py2.5-macosx-10.3-fat.egg/Cheetah/
> Compiler.py", line 33, in <module>
>     from Cheetah.Parser import Parser, ParseError, specialVarRE,
> STATIC_CACHE, REFRESH_CACHE
>   File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
> python2.5/site-packages/Cheetah-1.0-py2.5-macosx-10.3-fat.egg/Cheetah/
> Parser.py", line 32, in <module>
>     from Cheetah import ErrorCatchers
>   File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
> python2.5/site-packages/Cheetah-1.0-py2.5-macosx-10.3-fat.egg/Cheetah/
> ErrorCatchers.py", line 16, in <module>
>     from Cheetah.NameMapper import NotFound
>   File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
> python2.5/site-packages/Cheetah-1.0-py2.5-macosx-10.3-fat.egg/Cheetah/
> NameMapper.py", line 146
>     from __future__ import generators
> SyntaxError: from __future__ imports must occur at the beginning of
> the file
> mathilde:/Users/eljakim/Desktop/Cheetah-2.0rc8:
>
> I fixed it by moving the
>     from __future__ import generators
> three lines up.
>
> I had to do the same for the test for NameMapper.
>
> Would this be something that needs fixing in the default install?
>
> Eljakim
>
>
> -------------------------------------------------------------------------
> 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
> Cheetahtemplate-discuss@...
> https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
>

-------------------------------------------------------------------------
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
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

#4087 From: Tavis Rudd <tavis@...>
Date: Sat May 12, 2007 7:13 pm
Subject: Re: [Cheetahtemplate-discuss] Dynamically compiled cheetah classes vs. garbage collection
tavis@...
Send Email Send Email
 
Hi James,
Thanks for the kudos.  I'm happy to hear it's worked so well for you.

This should work fine, if you use an LRU cache implentation with good
thread synchronization. Have a look at the compilation cache
used by Template.compile(): Template._CHEETAH_compileCache.  You'll need
to sub in an LRU cache there which supports the dict interface.

Cheers,
Tavis
On Thu, 10 May 2007, James Robinson wrote:

> First off -- hats off to Cheetah, the tried and true workhorse of
> Python template engines. We've used Cheetah for 4 years now, rendering:
>
>  * /etc/hosts
>  * BIND zone files
>  * /etc/passwd
>  * /etc/aliases
>  * Makefiles
>  * Java source code
>  * Python source code
>  * and of course XHTML as embedded in FastCGIs.
>
> Having a non-HTML/XHTML centric templating engine lets us leverage it
> for most all of our textfile rendering needs. Soon to be added to
> that list will be Asterisk extension and voicemail configs.
>
> But back to our web-environment. We host a lot of virtual domains,
> and right now our web publishing framework is not vhost-aware -- each
> fastcgi instance is for a specific vhost with a distinct set of pages
> -- precompiled templates loaded via import.
>
> On our development machines, in order to speed up compile / edit /
> debug, we also support driving Cheetah compiler on the fly via:
>
>  template_source = open(fullpath, 'r').read()
>  clazz = Template.compile(template_source)
>
> In order to save memory on the fastcgi server machines, since the
> majority of the vhosts are idle most of the time and most of our
> server traffic is to our primary domain virtual host, we're going to
> teach the fastcgi processes how to be vhost aware. But if they end up
> import-ing all of the templates from all of the vhosts, then the
> memory usage just for the template classes could be rather vast.
>
> So, the real question is, if we also switch to using open() /
> Template.compile() and, say, a LRU cache of compiled templates, then
> when our userspace python code drops the last reference to a compiled
> template, would / could CPython free up the memory that the template
> class / module was using? Or am I dreaming?
>
> Thanks,
> James
>
> ----
> James Robinson
> Socialserve.com
>
>
> -------------------------------------------------------------------------
> 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
> Cheetahtemplate-discuss@...
> https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
>

-------------------------------------------------------------------------
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
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

#4088 From: "Mike Orr" <sluggoster@...>
Date: Sun May 13, 2007 6:13 am
Subject: Re: [Cheetahtemplate-discuss] Cheetah + Unicode: default encoding?
sluggoster@...
Send Email Send Email
 
On 5/11/07, Yannick Gingras <ygingras@...> wrote:
>
> In the doc, I found how to specify the encoding the literals in my
> templates (#ecoding) but I didn't find a way to specify the encoding
> to use to convert unicode fields.  At the moment, I do something like
>
>   Your hotel will be ${hotel.name.encode("utf-8")}.
>
> But somehow I find it ugly and unproductive.  If I ever decide to
> change a string to unicode in my data model, I have a lot of hunting
> to do and nothing will break until I use that field with actual
> unicode.  I will also have problems if I ever want to use another
> encoding though I admit I really don't see a case were UTF-8 is not
> the best choice.  Latin-1 is a tiny bit more compact for french but I
> wouldn't advise someone to use it.
>
> Is there an elegant way to tell Cheetah to encode all my unicode
> objects in UTF-8?

There's a new #unicode directive in 2.0rc8 that might help though it
doesn't do exactly what you describe; it turns the output into
Unicode.
http://cheetahtemplate.org/docs/CHANGES

You can also write a #filter that encodes placeholder values.


--
Mike Orr <sluggoster@...>

-------------------------------------------------------------------------
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
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

#4089 From: Raphael Marvie <raphael.marvie@...>
Date: Wed May 23, 2007 7:57 am
Subject: [Cheetahtemplate-discuss] Problem when using items, keys or values as names in searchList
raphael.marvie@...
Send Email Send Email
 
Hi,

I spent a lot of time figuring what was happening yesterday. When I
provide searchList with a dict containing the variables 'items',
'keys' or 'values', the rendering of a simple template has an
improper behavior. I suppose that the names 'items', 'keys' and
'values' are used internally by Template.respond() as having a
particular meaning (they all are functions of the dict class), but I
did not found information preventing the use of these variable names.
Here is the trace of a little interactive session presenting the
problem.

My 2 cents,

r.

Python 2.5.1 (r251:54869, Apr 18 2007, 22:08:04)
[GCC 4.0.1 (Apple Computer, Inc. build 5367)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
  >>> import Cheetah
  >>> Cheetah.Version
'2.0rc8'
  >>> tmpl = '''
... #for $key in $keys
...  - $key
... #end for
... '''
  >>> from Cheetah.Template import Template
  >>> print Template(tmpl, searchList=[dict(keys=range(3))]).respond()

- self
- write
- _filter
- SL
- trans
- _dummyTrans

  >>> tmpl = '''
... #for $item in $items
...  - $item
... #end for
... '''
  >>> from Cheetah.Template import Template
  >>> print Template(tmpl, searchList=[dict(items=range(3))]).respond()

- ('self',
<DynamicallyCompiledCheetahTemplate.DynamicallyCompiledCheetahTemplate o
bject at 0x849d0>)
- ('write', <built-in method append of list object at 0x1150788>)
- ('_filter', <bound method RawOrEncodedUnicode.filter of
<Cheetah.Filters.RawOrEncodedUnicode object at 0x84950>>)
- ('SL', [{}, {'items': [0, 1, 2]},
<DynamicallyCompiledCheetahTemplate.DynamicallyCompiledCheetahTemplate o
bject at 0x849d0>])
- ('trans', <Cheetah.DummyTransaction.DummyTransaction instance at
0x1153350>)
- ('_dummyTrans', True)

  >>> tmpl = '''
... #for $value in $values
...  - $value
... #end for
... '''
  >>> print Template(tmpl, searchList=[dict(values=range(3))]).respond()
Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    File
"cheetah_DynamicallyCompiledCheetahTemplate_2007052309320469605.py",
line 90, in respond
    File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/Cheetah-2.0rc7-py2.5-macosx-10.3-fat.egg/
Cheetah/Filters.py", line 142, in filter
      filtered = str(val)
    File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/Cheetah-2.0rc7-py2.5-macosx-10.3-fat.egg/
Cheetah/Template.py", line 990, in __str__
      def __str__(self): return getattr(self, mainMethName)()
    File
"cheetah_DynamicallyCompiledCheetahTemplate_2007052309320469605.py",
line 90, in respond
    File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/Cheetah-2.0rc7-py2.5-macosx-10.3-fat.egg/
Cheetah/Filters.py", line 142, in filter
      filtered = str(val)

...

RuntimeError: maximum recursion depth exceeded


--
Raphael Marvie, PhD                http://www.lifl.fr/~marvie/
Maître de Conférences / Associate Professor  @  LIFL -- IRCICA
Directeur du Master Informatique Professionnel spécialité IAGL
Head of Master's in Software Engineering     +33 3 28 77 85 83



-------------------------------------------------------------------------
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
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

#4090 From: "Mike Orr" <sluggoster@...>
Date: Wed May 23, 2007 1:09 pm
Subject: Re: [Cheetahtemplate-discuss] Problem when using items, keys or values as names in searchList
sluggoster@...
Send Email Send Email
 
On 5/23/07, Raphael Marvie <raphael.marvie@...> wrote:
>
> Hi,
>
> I spent a lot of time figuring what was happening yesterday. When I
> provide searchList with a dict containing the variables 'items',
> 'keys' or 'values', the rendering of a simple template has an
> improper behavior. I suppose that the names 'items', 'keys' and
> 'values' are used internally by Template.respond() as having a
> particular meaning (they all are functions of the dict class), but I
> did not found information preventing the use of these variable names.

It's a limitation of how the NameMapper works -- attributes override
keys -- and the fact that the first item in the search list is a dict
(the "#set globals" dict).  So you can't use placeholder names that
match dict methods.  I remember documenting that several times and
thought I put it in the Users' Guide but I can't find it now, hmm.

--
Mike Orr <sluggoster@...>

-------------------------------------------------------------------------
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
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

#4091 From: Raphael Marvie <raphael.marvie@...>
Date: Wed May 23, 2007 1:14 pm
Subject: Re: [Cheetahtemplate-discuss] Problem when using items, keys or values as names in searchList
raphael.marvie@...
Send Email Send Email
 
Thanks a lot.

r.

On May 23, 2007, at 3:09 PM, Mike Orr wrote:

> On 5/23/07, Raphael Marvie <raphael.marvie@...> wrote:
>>
>> Hi,
>>
>> I spent a lot of time figuring what was happening yesterday. When I
>> provide searchList with a dict containing the variables 'items',
>> 'keys' or 'values', the rendering of a simple template has an
>> improper behavior. I suppose that the names 'items', 'keys' and
>> 'values' are used internally by Template.respond() as having a
>> particular meaning (they all are functions of the dict class), but I
>> did not found information preventing the use of these variable names.
>
> It's a limitation of how the NameMapper works -- attributes override
> keys -- and the fact that the first item in the search list is a dict
> (the "#set globals" dict).  So you can't use placeholder names that
> match dict methods.  I remember documenting that several times and
> thought I put it in the Users' Guide but I can't find it now, hmm.
>
> --
> Mike Orr <sluggoster@...>
>
> ----------------------------------------------------------------------
> ---
> 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
> Cheetahtemplate-discuss@...
> https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

--
Raphael Marvie, PhD                http://www.lifl.fr/~marvie/
Maître de Conférences / Associate Professor  @  LIFL -- IRCICA
Directeur du Master Informatique Professionnel spécialité IAGL
Head of Master's in Software Engineering     +33 3 28 77 85 83



-------------------------------------------------------------------------
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
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

#4092 From: "Ramashish Baranwal" <ramashish.lists@...>
Date: Fri May 25, 2007 6:44 pm
Subject: [Cheetahtemplate-discuss] Question about #include
ramashish.lists@...
Send Email Send Email
 
Hi,

I have a question about #include directive. If I #include another
template file, and compile the original file to a python class, do I
need to have the included file too at runtime. Consider this trivial
example-

## parent.tmpl
#include 'child.tmpl'

## Other stuff
## ...

## child.tmpl
## Child stuff
## ..

Now I compile parent.tmpl to parent.py. Do I still need child.tmpl to
generate output from parent.py? If yes, can this be avoided?

Thanks in advance,
-Ram

-------------------------------------------------------------------------
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
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

#4093 From: AndCycle <andcycle@...>
Date: Fri May 25, 2007 7:28 pm
Subject: Re: [Cheetahtemplate-discuss] Question about #include
andcycle@...
Send Email Send Email
 
Ramashish Baranwal æåˆ°:
> Hi,
>
> I have a question about #include directive. If I #include another
> template file, and compile the original file to a python class, do I
> need to have the included file too at runtime. Consider this trivial
> example-
>
> ## parent.tmpl
> #include 'child.tmpl'
>
> ## Other stuff
> ## ...
>
> ## child.tmpl
> ## Child stuff
> ## ..
>
> Now I compile parent.tmpl to parent.py. Do I still need child.tmpl to
> generate output from parent.py? If yes, can this be avoided?
>
> Thanks in advance,
> -Ram
>
>
cheetah's include is used as a run-time directive, and it got path problem,
I just can't get into cheetah so I moved into Mako template.


-------------------------------------------------------------------------
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
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

#4094 From: Tavis Rudd <tavis@...>
Date: Fri May 25, 2007 9:16 pm
Subject: Re: [Cheetahtemplate-discuss] Question about #include
tavis@...
Send Email Send Email
 
Hi Ramashish,
You should inheritance via #extends to do this sort of thing instead of
using #include.  Note, both are runtime rather than compile-time and,
thus, they both rely on the parent template being accessible.  However,
there is no reverse dependency and parent does not rely on child.
Cheers,
Tavis

On Sat, 26 May 2007, Ramashish Baranwal wrote:

> Hi,
>
> I have a question about #include directive. If I #include another
> template file, and compile the original file to a python class, do I
> need to have the included file too at runtime. Consider this trivial
> example-
>
> ## parent.tmpl
> #include 'child.tmpl'
>
> ## Other stuff
> ## ...
>
> ## child.tmpl
> ## Child stuff
> ## ..
>
> Now I compile parent.tmpl to parent.py. Do I still need child.tmpl to
> generate output from parent.py? If yes, can this be avoided?
>
> Thanks in advance,
> -Ram
>
> -------------------------------------------------------------------------
> 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
> Cheetahtemplate-discuss@...
> https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
>

-------------------------------------------------------------------------
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
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

#4095 From: Tavis Rudd <tavis@...>
Date: Fri May 25, 2007 9:18 pm
Subject: Re: [Cheetahtemplate-discuss] Question about #include
tavis@...
Send Email Send Email
 
There's no path problem with #include, it just leaves path management up
to the user or the framework it is being used with.

On Sat, 26 May 2007, AndCycle wrote:

> Ramashish Baranwal æåˆ°:
>> Hi,
>>
>> I have a question about #include directive. If I #include another
>> template file, and compile the original file to a python class, do I
>> need to have the included file too at runtime. Consider this trivial
>> example-
>>
>> ## parent.tmpl
>> #include 'child.tmpl'
>>
>> ## Other stuff
>> ## ...
>>
>> ## child.tmpl
>> ## Child stuff
>> ## ..
>>
>> Now I compile parent.tmpl to parent.py. Do I still need child.tmpl to
>> generate output from parent.py? If yes, can this be avoided?
>>
>> Thanks in advance,
>> -Ram
>>
>>
> cheetah's include is used as a run-time directive, and it got path problem,
> I just can't get into cheetah so I moved into Mako template.
>
>
> -------------------------------------------------------------------------
> 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
> Cheetahtemplate-discuss@...
> https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
>
-------------------------------------------------------------------------
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
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

#4096 From: Yannick Gingras <ygingras@...>
Date: Sat May 26, 2007 5:10 pm
Subject: Re: [Cheetahtemplate-discuss] Caching and TurboCheetah
ygingras@...
Send Email Send Email
 
"Mike Orr" <sluggoster@...> writes:

> TurboCheetah does not reuse template instances.  It recompiles the
> template each time.  If you pass the "cheetah.precompiled" option, it
> imports a .py template module instead.  Neither of these will help in
> your case.
>
> Caching template instances in a web framework would take some careful
> Cheetah-specific thinking.  You'd have to lock the instance so another
> thread can't access it while you set the placeholder values and fill
> the template.  (See Python's mutex module for a locking strategy.)
> You can set the values via 'self' attributes or -- probably better --
> put a dict in the search list and keep a separate reference to it so
> you can modify the dict in place.  This is all too specific for a
> general-purpose tool like TurboCheetah, though you could make a custom
> version of TurboCheetah that did it.

I looked at Mako.  It has an ugly syntax but it is quite close to
Cheetah in semantic and functionality.  It has support for caching
though an external memcached server.  It is also well integrated in
Pylons.  It will be easier for me to go with Mako but I wonder how
hard it would be to port the memcached support from Mako to Cheetah.

--
Yannick Gingras


-------------------------------------------------------------------------
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
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

#4097 From: Yannick Gingras <ygingras@...>
Date: Sat May 26, 2007 5:38 pm
Subject: Re: [Cheetahtemplate-discuss] Cheetah + Unicode: default encoding?
ygingras@...
Send Email Send Email
 
"Mike Orr" <sluggoster@...> writes:

> There's a new #unicode directive in 2.0rc8 that might help though it
> doesn't do exactly what you describe; it turns the output into
> Unicode.
> http://cheetahtemplate.org/docs/CHANGES
>
> You can also write a #filter that encodes placeholder values.

I ended using Mako for its caching support.  It has encoding support
similar as what you describe and it support returning a unicode object
directly through render_unicode().  I think that it does all the
internal rendering in unicode and encodes only at the end:

   http://www.makotemplates.org/docs/unicode.html

--
Yannick Gingras


-------------------------------------------------------------------------
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
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

#4098 From: tom wible <airdrummer@...>
Date: Thu Jun 14, 2007 10:25 pm
Subject: [Cheetahtemplate-discuss] cheetah self-test failure
airdrummer@...
Send Email Send Email
 
$ cd Cheetah-2.0rc8/

$ python setup.py install

$ cheetah t

Traceback (most recent call last):

    File "/usr/bin/cheetah", line 3, in <module>

      CheetahWrapper().main()

    File "/usr/lib/python2.5/site-packages/Cheetah/CheetahWrapper.py",
line 183, in main

      meth()

    File "/usr/lib/python2.5/site-packages/Cheetah/CheetahWrapper.py",
line 270, in test

      sys.argv.extend(self.testOpts)

AttributeError: CheetahWrapper instance has no attribute 'testOpts'





$ python

Python 2.5.1 (r251:54863, May 18 2007, 16:56:43)

[GCC 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)] on cygwin



$ uname -a

CYGWIN_NT-5.1 AP2WSGRBKRC 1.5.24(0.156/4/2) 2007-01-31 10:57 i686 Cygwin




-------------------------------------------------------------------------
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
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

#4099 From: tom wible <airdrummer@...>
Date: Fri Jun 15, 2007 8:51 pm
Subject: [Cheetahtemplate-discuss] osx install problem
airdrummer@...
Send Email Send Email
 
building 'Cheetah._namemapper' extension
creating build/temp.macosx-10.3-fat-2.5
creating build/temp.macosx-10.3-fat-2.5/src
gcc -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk
-fno-strict-aliasing -Wno-long-double -no-cpp-precomp -mno-fused-madd
-fno-common -dynamic -DNDEBUG -g -O3
-I/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5 -c
src/_namemapper.c -o build/temp.macosx-10.3-fat-2.5/src/_namemapper.o
gcc: installation problem, cannot exec 'i686-apple-darwin8-gcc-4.0.0': No such
file or directory
lipo: can't figure out the architecture type of: /var/tmp//ccqrcIRr.out
error: command 'gcc' failed with exit status 255
tomspbook:/usr/local/Cheetah-2.0rc8 osxadmin$ gcc
powerpc-apple-darwin8-gcc-4.0.0: no input files

tomspbook:/usr/local/Cheetah-2.0rc8 osxadmin$ ls -l `which gcc`
lrwxr-xr-x   1 root  wheel  7 Apr 17 21:10 /usr/bin/gcc -> gcc-4.0

tomspbook:/usr/local/Cheetah-2.0rc8 osxadmin$ uname -a
Darwin tomspbook 8.9.0 Darwin Kernel Version 8.9.0: Thu Feb 22 20:54:07 PST
2007; root:xnu-792.17.14~1/RELEASE_PPC Power Macintosh powerpc
tomspbook:/usr/local/Cheetah-2.0rc8 osxadmin$

-------------------------------------------------------------------------
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
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

Messages 4070 - 4099 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