example applications are poor examples

Bug #143875 reported by bjdevlin
2
Affects Status Importance Assigned to Milestone
Zope 2
Fix Released
Medium
Unassigned

Bug Description

The index_html object in the GuestBook, FileLibrary, Navigation and ShoppingCart examples installed by the Zope Quick Start' at the top right of the ZMI do not contain DTML or TAL markup.

This is very confusing for newbies like myself, as we cannot understand how these sample applications are working. Either the wrong thing is being displayed upon clicking on the Edit tab, or some new technique is being used in linking the ordinary html in the index_html with the other components (scripts, folders, etc) that make up these applications. This needs to be fixed as they are currently a barrier to learning Zope.

Trying to discuss these discrepencies on IRC just brought up implications one had not RTFM.

Tags: bug zope
Revision history for this message
Andreas Jung (ajung) wrote :

Status: Pending => Wontfix

The quickstart and examples stuff are obsolete. This won't be fixed.

Revision history for this message
Chris McDonough (chrism-plope) wrote :

Status: Wontfix => Pending

What is the real problem here? When the examples are imported, what causes this behavior? It seems to show the rendered view. Is it due to the change to Z3 page templates? Note that the quickstart page on the trunk still has links that try to import and view the examples.

Revision history for this message
Chris McDonough (chrism-plope) wrote :

After poking around a bit, I've found that this isn't really a problem with the examples, instead it's a bug which causes the entire page template to be rendered instead of just macro-included content when "expand macros while editing" is checked (i.e. if "self.expand" is true on the template object). Due to this bug, and because self.expand is true for the imported example objects, the initial thing shown in the textarea is the full-on rendering of the template as opposed to the template source.

The same problem is not evident in Zope 2.8. But rankly I'm not sure what the hell "expand macros while editing" is supposed to do, it doesn't seem to expand the macros at all in 2.8 even when its selected.

I don't know how to fix this but it's a bug because any zexp-exported pagetemplate with self.expand set to true is essentially noneditable in the web interface in 2.10+.

Revision history for this message
Philipp von Weitershausen (philikon) wrote :

Is there a traceback? If so, could you please provide it. Also, how would I reproduce this problem in a unittest? I'd be willing to look at this, but I'd need to reproduce this from Python.

Revision history for this message
Chris McDonough (chrism-plope) wrote :

No traceback, it just renders the wrong stuff into the edit textarea.

From zopectl debug in 2.8, where "foo_pt" is a page template object in the ZODB root with the text '<html>\n <title tal:content="template/title">The title</title>\n</html>\n', demonstrating the "old" (expected?) behavior:
:
>>> from Testing import makerequest
>>> app = makerequest.makerequest(app)
>>> app.foo_pt.read()
'<html>\n <title tal:content="template/title">The title</title>\n</html>\n'
>>> app.foo_pt._text
'<html>\n <title tal:content="template/title">The title</title>\n</html>\n'
>>> app.foo_pt.expand
0
>>> app.foo_pt.expand = 1
>>> app.foo_pt.read()
'<html>\n <title tal:content="template/title">The title</title>\n</html>\n'

Same thing for 2.11/trunk (and presumably 2.10 as reported by the OP):

>>> from Testing import makerequest
>>> app = makerequest.makerequest(app)
>>> app.foo_pt._text
u'<html>\n <title tal:content="template/title">The title</title>\n</html>'
>>> app.foo_pt.read()
u'<html>\n <title tal:content="template/title">The title</title>\n</html>'
>>> app.foo_pt.expand
0
>>> app.foo_pt.expand = 1
>>> app.foo_pt.read()
u'<html>\n <title>The title</title>\n</html>\n'

Note that when expand=1, the entire template is rendered rather than just macros. ".read()" is called by the ptEdit.zpt page template to populate the edit textarea.

Revision history for this message
Philipp von Weitershausen (philikon) wrote :

Status: Pending => Accepted

 Supporters added: philikon

Thanks. I'll take a look.

Revision history for this message
Jens Vagelpohl (dataflake-deactivatedaccount-deactivatedaccount) wrote :

I cannot reproduce the faulty behavior on Zope 2.12 anymore, it's been solved.

Changed in zope2:
assignee: Philipp von Weitershausen (philikon) → Jens Vagelpohl (jens-dataflake)
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.