Log message for revision 66232: template -> zpt Changed: U Products.Five/branches/philikon-local-components/component/configure.zcml D Products.Five/branches/philikon-local-components/component/customizetemplate.pt A Products.Five/branches/philikon-local-components/component/customizezpt.pt D Products.Five/branches/philikon-local-components/component/templateviews.pt U Products.Five/branches/philikon-local-components/component/zpt.txt A Products.Five/branches/philikon-local-components/component/zptviews.pt
-=- Modified: Products.Five/branches/philikon-local-components/component/configure.zcml =================================================================== --- Products.Five/branches/philikon-local-components/component/configure.zcml 2006-03-27 10:41:13 UTC (rev 66231) +++ Products.Five/branches/philikon-local-components/component/configure.zcml 2006-03-27 11:09:49 UTC (rev 66232) @@ -28,15 +28,15 @@ permission="five.ManageSite"> <browser:page - name="templateviews.html" - template="templateviews.pt" + name="zptviews.html" + template="zptviews.pt" /> <browser:page - name="customizetemplate.html" - template="customizetemplate.pt" + name="customizezpt.html" + template="customizezpt.pt" /> <browser:page - name="customizetemplate" + name="customizezpt" attribute="customizeTemplate" /> Deleted: Products.Five/branches/philikon-local-components/component/customizetemplate.pt =================================================================== --- Products.Five/branches/philikon-local-components/component/customizetemplate.pt 2006-03-27 10:41:13 UTC (rev 66231) +++ Products.Five/branches/philikon-local-components/component/customizetemplate.pt 2006-03-27 11:09:49 UTC (rev 66232) @@ -1,26 +0,0 @@ -<html metal:use-macro="context/@@standard_macros/view" - i18n:domain="zope"> - <body> - <div metal:fill-slot="body"> - - <p i18n:translate="">This is the source of the - <code tal:content="request/form/viewname">viewname</code>:</p> - - <pre style="background-color: #cccccc; border: 1px solid black; padding: 5px;" - tal:content="python:view.templateFromViewname(request.form['viewname']).read()"> - template source - </pre> - - <form action="@@customizetemplate" method="post" - enctype="multipart/form-data"> - - <input type="hidden" name="viewname" value="theviewname" - tal:attributes="value request/form/viewname" /> - <input type="submit" name="" value="Customize" /> - - </form> - - </div> - </body> - -</html> Copied: Products.Five/branches/philikon-local-components/component/customizezpt.pt (from rev 65825, Products.Five/branches/philikon-local-components/component/customizetemplate.pt) =================================================================== --- Products.Five/branches/philikon-local-components/component/customizetemplate.pt 2006-03-05 16:32:34 UTC (rev 65825) +++ Products.Five/branches/philikon-local-components/component/customizezpt.pt 2006-03-27 11:09:49 UTC (rev 66232) @@ -0,0 +1,26 @@ +<html metal:use-macro="context/@@standard_macros/view" + i18n:domain="zope"> + <body> + <div metal:fill-slot="body"> + + <p i18n:translate="">This is the source of the + <code tal:content="request/form/viewname">viewname</code>:</p> + + <pre style="background-color: #cccccc; border: 1px solid black; padding: 5px;" + tal:content="python:view.templateFromViewname(request.form['viewname']).read()"> + template source + </pre> + + <form action="@@customizezpt" method="post" + enctype="multipart/form-data"> + + <input type="hidden" name="viewname" value="theviewname" + tal:attributes="value request/form/viewname" /> + <input type="submit" name="" value="Customize" /> + + </form> + + </div> + </body> + +</html> Deleted: Products.Five/branches/philikon-local-components/component/templateviews.pt =================================================================== --- Products.Five/branches/philikon-local-components/component/templateviews.pt 2006-03-27 10:41:13 UTC (rev 66231) +++ Products.Five/branches/philikon-local-components/component/templateviews.pt 2006-03-27 11:09:49 UTC (rev 66232) @@ -1,33 +0,0 @@ -<html metal:use-macro="context/@@standard_macros/view" - i18n:domain="zope"> - <body> - <div metal:fill-slot="body"> - - <p i18n:translate="">Template-based (global) browser views available - for this component:</p> - - <table> - <tr> - <th></th> - <th>Name of View</th> - <th>Registration Info</th> - </tr> - <tr tal:repeat="info view/templateViewRegInfo"> - <td><img src="misc_/PageTemplates/zpt.gif" - tal:attributes="src string:${context/@@absolute_url}/misc_/PageTemplates/zpt.gif" /></td> - <td> - <a href="" - tal:attributes="href string:@@customizetemplate.html?viewname=${info/viewname}" - tal:content="info/viewname"> - </a> - </td> - <td><code tal:content="info/zptfile">zptfile</code><br /> - <code tal:content="info/for">for</code><br /> - <code tal:content="info/zcmlfile">zcmlfile</code></td> - </tr> - </table> - - </div> - </body> - -</html> Modified: Products.Five/branches/philikon-local-components/component/zpt.txt =================================================================== --- Products.Five/branches/philikon-local-components/component/zpt.txt 2006-03-27 10:41:13 UTC (rev 66231) +++ Products.Five/branches/philikon-local-components/component/zpt.txt 2006-03-27 11:09:49 UTC (rev 66232) @@ -28,6 +28,7 @@ >>> import zope.app.event >>> zcml.load_config('meta.zcml', Products.Five) >>> zcml.load_config('permissions.zcml', Products.Five) + #>>> zcml.load_config('traversing.zcml', Products.Five) >>> zcml.load_config('configure.zcml', Products.Five.component) >>> zcml.load_config('configure.zcml', zope.app.event) @@ -89,13 +90,13 @@ registered at): >>> view = zope.component.getMultiAdapter((item, request), - ... name=u"templateviews.html") + ... name=u"zptviews.html") >>> view = view.__of__(item) >>> from pprint import pprint >>> viewnames = [reg.name for reg in view.templateViewRegistrations()] >>> viewnames.sort() >>> pprint(viewnames) - [u'customizetemplate.html', u'templateviews.html'] + [u'customizezpt.html', u'zptviews.html'] 3. and 4. Customizing a template-based view @@ -105,12 +106,12 @@ the source of its template: >>> view = zope.component.getMultiAdapter((item, request), - ... name=u"customizetemplate.html") + ... name=u"customizezpt.html") >>> view = view.__of__(item) - >>> template = view.templateFromViewname(u'customizetemplate.html') + >>> template = view.templateFromViewname(u'customizezpt.html') >>> import os.path >>> os.path.basename(template.filename) - 'customizetemplate.pt' + 'customizezpt.pt' >>> print template.read() #doctest: +ELLIPSIS <html metal:use-macro="context/@@standard_macros/view" @@ -122,13 +123,13 @@ We now hit the customize button and get a customized ZPT template: - >>> zpt = view.doCustomizeTemplate(u'customizetemplate.html') + >>> zpt = view.doCustomizeTemplate(u'customizezpt.html') That actually creates a PageTemplate object in the nearest site (perhaps later we'd like to have the option to pick which of the sites above us should be targeted) - >>> zpt = getattr(site, 'customizetemplate.pt') + >>> zpt = getattr(site, 'customizezpt.pt') >>> print zpt.read() #doctest: +ELLIPSIS <html metal:use-macro="context/@@standard_macros/view" i18n:domain="zope"> @@ -162,15 +163,15 @@ Now look it up and compare its output: >>> view = zope.component.getMultiAdapter((item, request), - ... name=u"customizetemplate.html") + ... name=u"customizezpt.html") >>> view = view.__of__(item) >>> print view() #doctest: +ELLIPSIS context: <SimpleContent at item> container: <SimpleContent at item> root: <Application at > - template: <ZopePageTemplate at customizetemplate.pt> + template: <ZopePageTemplate at customizezpt.pt> request: <zope.publisher.browser.TestRequest instance URL=http://127.0.0.1> - view: <Products.Five.metaclass.SimpleViewClass from .../Five/component/customizetemplate.pt object at ...> + view: <Products.Five.metaclass.SimpleViewClass from .../Five/component/customizezpt.pt object at ...> modules: <Products.PageTemplates.ZRPythonExpr._SecureModuleImporter instance at ...> options: {'args': ()} nothing: @@ -184,12 +185,12 @@ easiest way to do that is to simply delete the template: >>> if True: - ... site._delObject('customizetemplate.pt') + ... site._delObject('customizezpt.pt') Now the view look-up is back to the old way: >>> view = zope.component.getMultiAdapter((item, request), - ... name=u"customizetemplate.html") + ... name=u"customizezpt.html") >>> print view.index.read() #doctest: +ELLIPSIS <html metal:use-macro="context/@@standard_macros/view" i18n:domain="zope"> Copied: Products.Five/branches/philikon-local-components/component/zptviews.pt (from rev 66158, Products.Five/branches/philikon-local-components/component/templateviews.pt) _______________________________________________ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins