dunno whether this will help you, but here are two hints. today i
wrote the following snippet:

from yaml import safe_load as _loadYaml
from mako.template import Template as _MakoTemplate

  def foo( self ):
    rawYaml       = file( self.fooFileLocator, 'rb' ).read()
    processedYaml = _MakoTemplate( rawYaml ).render()
    return _loadYaml( processedYaml )

so this is how to make mako work for files that are loaded 'manually',
as it were -- in this case, what yaml gets to see is the result of
mako's template rendering. i haven't tested it much yet, but at least
pylon's `g` *is* available inside the template, and since i put my
app's configuration into an object `g.cfg`, this is around 90% of
functionality i'd want to have in a template.

second, i plan to move things around a bit in pylons, and as an
intermediate solution i added more locations where templates can go.
this is how i modified `config/environment.py`:

  import os.path as _osp
  paths = {
    'root_path':    root_path,
    'controllers':  _osp.join( root_path, 'controllers' ),
    'templates':    [ _osp.join( root_path, path )
      for path in ( 'components', 'templates', 'modules', ) ],
    'static_files': _osp.join( root_path, 'public' )
     }

it is a bit confusing that the `controllers` seemingly does not accept
multiple locations whereas `templates` does.

_wolf



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" 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/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to