Hi Mitch,

I don't personally use repoze.bfg.jinja2

I would configure jinja separately with something like this at the top  
of views.py:

        from webob import Response
        from jinja2 import Environment, PackageLoader
        env = Environment(loader=PackageLoader(PACKAGE_NAME, 'path/to/ 
templates')) # 'path/to' is from the base of the package

and then to return the template in a view, use something like:

        template = env.get_template(path)
        return Response(template.render())

Cheers,

Fergus

On 25 Aug 2009, at 02:35, Chris McDonough wrote:

>
> On 8/24/09 11:25 AM, Mitchell Garnaat wrote:
>> I'm not explicitly specifying a Loader.  Perhaps that's my  
>> problem?  I'm
>> just getting started with repoze.bfg so silly mistakes are a  
>> given.  I
>> looked briefly at the code behind the jinja2 support and it seemed  
>> that
>> it was using a hardcoded FunctionLoader.  Is there a way to  
>> override that?
>
> No.  You'll likely need to change repoze.bfg.jinja2 to get a  
> different loader,
> if changing the loader helps.  I don't know how to tell you to  
> proceed in
> getting what you want, however, because even though I wrote the  
> bindings, I
> don't personally use Jinja2.  Maybe someone more familiar with  
> Jinja2 (such as
> the Pocoo guys) could help you figure out what needs to be done to  
> change it.
>
> - C
>
>
>>
>> Thanks,
>>
>> Mitch
>>
>> On Mon, Aug 24, 2009 at 4:23 AM, Fergus Doyle
>> <fergus.do...@largeblue.com <mailto:fergus.do...@largeblue.com>>  
>> wrote:
>>
>>    Hi Mitch,
>>
>>    What kind of Loader are you using for your Environment?
>>
>>    Cheers,
>>
>>    Fergus
>>
>>    On 24/08/2009 05:42, Mitchell Garnaat wrote:
>>>    Hi -
>>>
>>>    I've got Jinja2 working with repoze.bfg but if I want to do
>>>    template inheritance, I need to specify an absolute file path,
>>>    like this:
>>>
>>>    {% extends
>>>    '/Users/mitch/Projects/foobar/foobar/templates/layout.html' %}
>>>
>>>    rather than something like this:
>>>
>>>    {% extends 'layout.html' %}
>>>
>>>    Is this by design?  Or is there some config option I need to set?
>>>    I'd really rather not have absolute path names in my templates if
>>>    I can avoid it.
>>>
>>>    Thanks,
>>>
>>>    Mitch
>>>     
>>> ------------------------------------------------------------------------
>>>
>>>    _______________________________________________
>>>    Repoze-dev mailing list
>>>    Repoze-dev@lists.repoze.org  <mailto:Repoze-dev@lists.repoze.org>
>>>    http://lists.repoze.org/listinfo/repoze-dev
>>>
>>
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Repoze-dev mailing list
>> Repoze-dev@lists.repoze.org
>> http://lists.repoze.org/listinfo/repoze-dev
>
> _______________________________________________
> Repoze-dev mailing list
> Repoze-dev@lists.repoze.org
> http://lists.repoze.org/listinfo/repoze-dev

_______________________________________________
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev

Reply via email to