comment below
On 1/22/10 10:37 PM, Chris McDonough wrote:
> 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 (
>> ) 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/', 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
My test is failing with both version 1.0 and 1.0.8.  Pretty sure this is
a Chameleon bug as well.
I did 30 minutes of pdb and didn't get anywhere so I thought it might be
better to mention it instead.  I think in the is where it
happens.  I should have time on Monday to try to find a fix if no one
gets to it by then.

I also heard from Erik Steele that they have just been hacking out the
xml and DOCTYPE declarations in Plone 4.0 macros templates for the same

Repoze-dev mailing list

Reply via email to