Kevin J. Kalupson wrote:
> Hi All,
> 
> I'm having an issue with chameleon.zpt templates and macros.  I've
> create two templates, one with a macro and slots and one that is used to
> fill the slots in my main template.  Both templates have an xml and
> DOCTYPE declaration.  The issue is that the final rendered page ends up
> having two xml declarations and two DOCTYPE declarations.
> 
> I can fix my rendered page by removing the declarations, but if I want
> to develop the individual templates further and validate as I go I need
> re-add the declarations.
> 
> I put together a simple bfg app (
> https://weblion.psu.edu/trac/weblion/browser/users/kjk137/chameleon_zpt_test
> ) that demonstrates this issue including a test.  Here is my test, it
> seems to be a little more complicated than I expected compared to
> testing views without macros.  Am I doing this in a good way or is there
> a better method?
> 
> 
>     def test_my_view_renderer(self):
>         from chameleon_zpt_test.views import my_view
>         context = testing.DummyModel()
>         request = testing.DummyRequest()
>         info = my_view(context, request)
>         from repoze.bfg.chameleon_zpt import renderer_factory
>         renderer
> =renderer_factory('chameleon_zpt_test:templates/mytemplate.pt', level=3)
>         from repoze.bfg.view import rendered_response
>         from chameleon_zpt_test.views import my_view
>         response = my_view(context, request)
>         result = renderer(response{'context':context,'request':request})
>         self.assertEqual(result.count('<?xml version='),1)
>         self.assertEqual(result.count('<!DOCTYPE html'),1)

Do you know what version of Chameleon you're using?  This is almost certainly a 
Chameleon bug rather than a BFG bug, so it would be useful to know the version.

- C

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

Reply via email to