Re: [Repoze-dev] [issue139] Chameleon - can't create xml and doctype declarations from macro
Shane, Sorry about sending from the wrong email address - thanks for grabbing the relevant bit and putting it back in the thread. On 3/4/10 9:47 PM, Shane Hathaway wrote: > Kevin Kalupson wrote: >> The importance to me is that there isn't a regression to the duplicate >> xml headers when templates render. I like to validate my templates as I >> go and not have to hack them to then test my rendered template. > > Good point. If you're statically validating all templates, then putting > the doctype in every template is a good thing. I think that this is the way to go with zpt and is the often forgotten beauty of zpt. Because you can do this is what makes it better than a lot of other templating languages out there. However, if you're not > statically validating, then putting the doctype in every template is > hazardous, because it's easy to forget, and if you forget, the browser > quietly slips into quirks mode, causing insidious little CSS bugs. > > The moral: I guess static template validation would have saved me those > hours I spent debugging CSS this week, and maybe putting the doctype in > the main template has more cons than pros. > > Shane > -Kevin ___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev
Re: [Repoze-dev] [issue139] Chameleon - can't create xml and doctype declarations from macro
On 3/4/10 2:50 PM, Malthe Borch wrote: > On 4 March 2010 22:45, Kevin J. Kalupson wrote: >> In that case, there should be macro explicitly containing the doctype >> and other wanted headers. > > Yes, but that's unfortunately impossible. > not impossible: standard_template.pt - http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd";> The Title Hey - this is a test. test.pt --- localhost:8080/test.pt - rendered source http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd";> Hey - this is a test. > I don't think it's a syntax issue, I think it's a behavioral issue. I >> think the 1.1 branch exhibits broken behavior. > > But keep in mind that we're mimicking ``zope.pagetemplate``. Most > people expect high corcordance. > > I just don't know about this. There's a work-around for you though: if > you don't define the macro as the root node, then you won't get the > doctype. > > \malthe -Kevin ___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev
Re: [Repoze-dev] [issue139] Chameleon - can't create xml and doctype declarations from macro
I just tested in zope2 through the zmi. standard_template.pt http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd";> The Title Hey - this is a test. test.pt --- http://localhost:8080/test.pt - source rendered --- Hey - this is a test. -Kevin On 3/4/10 2:50 PM, Shane Hathaway wrote: > Kevin J. Kalupson wrote: >> >> On 3/4/10 2:22 PM, Shane Hathaway wrote: >> The current syntax is >>> non-obvious and perhaps problematic, but workable. Some other syntax >>> might be better, but let's not break the current syntax in the 1.1 >>> branch. >>> >> I don't think it's a syntax issue, I think it's a behavioral issue. I >> think the 1.1 branch exhibits broken behavior. > > I'm pretty sure it was in 1.0 as well. It's a standard ZPT idiom. > > Shane ___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev
Re: [Repoze-dev] [issue139] Chameleon - can't create xml and doctype declarations from macro
On 3/4/10 2:22 PM, Shane Hathaway wrote: > Malthe Borch wrote: >> On 4 March 2010 22:02, Kevin Kalupson wrote: >>> I wouldn't expect the the xml headers in a macro template to be applied to >>> the >>> page template being rendered. It makes no sense to me that an element not >>> contained within a macro definition would be applied to the page calling the >>> macro under any situation. >> >> I sort of agree, except how else would we provide this functionality? >> Or is it actually the case that it doesn't make sense for a macro to >> control these headers –– I suspect it is. > > From a template developer's POV, it's useful to apply the same XML > declarations throughout a site using metal. In that case, there should be macro explicitly containing the doctype and other wanted headers. The current syntax is > non-obvious and perhaps problematic, but workable. Some other syntax > might be better, but let's not break the current syntax in the 1.1 branch. > I don't think it's a syntax issue, I think it's a behavioral issue. I think the 1.1 branch exhibits broken behavior. > Shane > > ___ > Repoze-dev mailing list > Repoze-dev@lists.repoze.org > http://lists.repoze.org/listinfo/repoze-dev -Kevin ___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev
Re: [Repoze-dev] [issue139] Chameleon - can't create xml and doctype declarations from macro
On 3/4/10 2:08 PM, Malthe Borch wrote: > On 4 March 2010 22:02, Kevin Kalupson wrote: >> I wouldn't expect the the xml headers in a macro template to be applied to >> the >> page template being rendered. It makes no sense to me that an element not >> contained within a macro definition would be applied to the page calling the >> macro under any situation. > > I sort of agree, except how else would we provide this functionality? > Or is it actually the case that it doesn't make sense for a macro to > control these headers –– I suspect it is. > I think it's the case that it doesn't make sense for the macro to control these headers. I have never had the expectation that a tag or header outside of a macro definition would appear in the final rendered page. > Plone's answer to this is to have its wrapper template manually write > out the XML declaration or maybe just the DOCTYPE. That seems kind of > crude as well. > > \malthe > ___ > Repoze-dev mailing list > Repoze-dev@lists.repoze.org > http://lists.repoze.org/listinfo/repoze-dev -Kevin ___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev
Re: [Repoze-dev] Chameleon issue and Testing Question
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 ( >> 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('> self.assertEqual(result.count(' > 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 etree.py 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 reason. -Kevin ___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev
[Repoze-dev] Chameleon issue and Testing Question
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('http://lists.repoze.org/listinfo/repoze-dev
Re: [Repoze-dev] Minor Typo in xml-rpc docs
per Hannosch' suggestion, I took a look at the docs in svn. Looks like the docs are correct in trunk. Kevin J. Kalupson wrote: > Hi, > I spotted a minor typo on http://docs.repoze.org/xmlrpc/ . > > near the top - > easy_install -i http://dist.repoze.org/bfgsite/simple repoze.bfg.xmrpc > > should be: > easy_install -i http://dist.repoze.org/bfgsite/simple repoze.bfg.xmlrpc > > > the rest of that page looks good to my eyes. > > -Kevin > > > ___ > 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] Minor Typo in xml-rpc docs
Hi, I spotted a minor typo on http://docs.repoze.org/xmlrpc/ . near the top - easy_install -i http://dist.repoze.org/bfgsite/simple repoze.bfg.xmrpc should be: easy_install -i http://dist.repoze.org/bfgsite/simple repoze.bfg.xmlrpc the rest of that page looks good to my eyes. -Kevin ___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev