Dear Anand

The reason i crossposted was this is a cheetah/webpy issue and hoping to
find jeremy james

1. the cheetah.py was removed.

2. jeremy james found a way to use cheetah from webpy, but he is not on the
group anymore

Cheetah is a very powerful tool integrated with webpy, Cheetah.py was
removed,but we kept a copy and are using it.
I m hoping to get cheetah.py to work well on webpy
thanks
I will post carefully and thanks for understanding

On 6/7/09, Anand Chitipothu <[email protected]> wrote:
>
>
> Dear mobiledreamers,
>
> Please stop spamming! If you have a genuine question, post it *only*
> in the right mailing list. Don't post to so many unrelated mailing
> lists. If you want to cite a webpage giving a link is sufficient. you
> don't have to copy and paste the whole content.
>
> Thanks,
> Anand
>
> 2009/6/7  <[email protected]>:
>
> >
> http://stackoverflow.com/questions/919539/how-do-we-precompile-base-templates-in-cheetah-so-that-include-extends-and-im/963546#963546
> >
> > Maybe compile automagically on as needed basis:
> >
> > import sys
> >
> > import os
> >
> > from os import path
> >
> > import logging
> >
> > from Cheetah.Template import Template
> >
> > from Cheetah.Compiler import Compiler
> >
> >
> > log = logging.getLogger(__name__)
> >
> >
> > _import_save = __import__
> >
> > def cheetah_import(name, *args, **kw):
> >
> >   """Import function which search for Cheetah templates.
> >
> >
> >   When template ``*.tmpl`` is found in ``sys.path`` matching module
> >   name (and corresponding generated Python module is outdated or
> >   not existent) it will be compiled prior to actual import.
> >   """
> >
> >   name_parts = name.split('.')
> >
> >   for p in sys.path:
> >
> >     basename = path.join(p, *name_parts)
> >
> >     tmpl_path = basename+'.tmpl'
> >
> >     py_path = basename+'.py'
> >
> >     if path.exists(tmpl_path):
> >
> >       log.debug("%s found in %r", name, tmpl_path)
> >
> >       if not path.exists(py_path) or newer(tmpl_path, py_path):
> >
> >         log.info("cheetah compile %r -> %r", tmpl_path, py_path)
> >
> >         output = Compiler(
> >
> >             file=tmpl_path,
> >
> >             moduleName=name,
> >
> >             mainClassName=name_parts[-1],
> >
>
> >             )
> >
> >         open(py_path, 'wb').write(str(output))
> >
> >       break
> >
> >   return _import_save(name, *args, **kw)
> >
> >
> > def newer(new, old):
> >
> >     """Whether file with path ``new`` is newer then at ``old``."""
> >
> >     return os.stat(new).st_mtime > os.stat(old).st_mtime
> >
> >
> > import __builtin__
> >
> > __builtin__.__import__ = cheetah_import
> >
> > >
> >
>
> >
>


-- 
Bidegg worlds best auction site
http://bidegg.com

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to