[Zope3-dev] base tags and structured text rendering

Jim Fulton jim at zope.com
Tue Nov 16 11:37:37 EST 2004


Craig Ewington wrote:
> I have a document

What do you mean by a document?

 > 'index.html' that contains a single line of structured
> text:
> 
> "a":a.html
> 
> to render the structured text, I have a page template that causes the 
> following lines of code to be invoked:

Is this a content-space page template? One added to a folder?

> source = zapi.createObject(None, u'zope.source.stx', text)
> view = zapi.getView(removeAllProxies(source), '', self.request)
> return view.render()
> 
> 
> When rendered, the following html is produced:
> 
> <a href="a.html">
> 
> The browser interprets this as http://localhost:9080/index.html/a.html 
> instead of http://localhost:a.html. This seems to be related to the 
> absence of a <base...> tag in the generated document. Should I
> 
> a) Insert a base tag in my skin's template file e.g. <base 
> tal:attributes="href context/@@absolute_url />
> b) Patch the structured text classes to take a base url and generate 
> absolute references instead of relative ones
> c) Something else..?

I suspect that this is due to a bug in content-space
page templates.  Most objects want to be the base for their
views.  Content objects that are themselves "documents"
want to treat themselves as their base.

The fix is pretty simple, although not as simple as it
should be.  There's a marker interface that should be
declared for objects like this that given them browser-
traversal adapters that give them correct interpretation
of URLs ending in / and bases.  Unfortunately, this interface
is in the wrong place. :( (This happened when some files
were rearranged a long tme ago.)

ZPT pages need to provide an interface named IFileContent.
Also, this interface needs to be moved to a different place.

Does anyone (contributor) want to fix this?

Jim

-- 
Jim Fulton           mailto:jim at zope.com       Python Powered!
CTO                  (540) 361-1714            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org


More information about the Zope3-dev mailing list