[Zope3-dev] XML header and TAL interpretor

Julien Anguenot ja at nuxeo.com
Wed Aug 31 08:35:44 EDT 2005


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ok the problem is the doctype declaration on top of the macro files that
force the tal interpretor to enter html mode and as far as I understand
you can't have mix moded macros.

If you change the doctype declaration with the xml header and add the
xmlns declaration for tal, metal and i18n then everything's fine after.

See for instance the navigation macros :

http://svn.zope.org/Zope3/trunk/src/zope/app/rotterdam/navigation_macros.pt?rev=28163&view=auto

If you change the header like this then it can be succesfully included :

<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:tal="http://xml.zope.org/namespaces/tal"
      xmlns:metal="http://xml.zope.org/namespaces/metal"
      xmlns:i18n="http://xml.zope.org/namespaces/i18n"
      i18n:domain="zope">
<body>


What kind of issue could we have changing the headers like this on all
the standard macros since it's xhtml already ?

	J.

Julien Anguenot wrote:
> Hi there,
> 
> I got a problem with the standard macros use and the XML header.
> 
> I've a view defined like the one below :
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <html
>     xmlns:tal="http://xml.zope.org/namespaces/tal"
>     xmlns:metal="http://xml.zope.org/namespaces/metal"
> 
>   <body metal:use-macro="context/@@standard_macros/page">
>     <!-- content -->
>   </body>
> </html>
> 
> And there, I got the following error when Zope's trying to render it :
> 
> -----
> 2005-08-31T13:21:56 ERROR SiteError
> http://localhost:8080/+/addBar.html%3Dbar
> Traceback (most recent call last):
>   File "/home/zopes/Zope-3_ECM/src/zope/publisher/publish.py", line 138,
> in publish
>     result = publication.callObject(request, object)
>   File
> "/home/zopes/Zope-3_ECM/src/zope/app/publication/zopepublication.py",
> line 164, in callObject
>     return mapply(ob, request.getPositionalArguments(), request)
>   File "/home/zopes/Zope-3_ECM/src/zope/publisher/publish.py", line 113,
> in mapply
>     return debug_call(object, args)
>   File "/home/zopes/Zope-3_ECM/src/zope/publisher/publish.py", line 119,
> in debug_call
>     return object(*args)
>   File
> "/home/zopes/Zope-3_ECM/src/zope/app/pagetemplate/simpleviewclass.py",
> line 44, in __call__
>     return self.index(*args, **kw)
>   File
> "/home/zopes/Zope-3_ECM/src/zope/app/pagetemplate/viewpagetemplatefile.py",
> line 83, in __call__
>     return self.im_func(im_self, *args, **kw)
>   File
> "/home/zopes/Zope-3_ECM/src/zope/app/pagetemplate/viewpagetemplatefile.py",
> line 51, in __call__
>     sourceAnnotations=getattr(debug_flags, 'sourceAnnotations', 0),
>   File "/home/zopes/Zope-3_ECM/src/zope/pagetemplate/pagetemplate.py",
> line 117, in pt_render
>     strictinsert=0, sourceAnnotations=sourceAnnotations)()
>   File "/home/zopes/Zope-3_ECM/src/zope/tal/talinterpreter.py", line
> 270, in __call__
>     self.interpret(self.program)
>   File "/home/zopes/Zope-3_ECM/src/zope/tal/talinterpreter.py", line
> 345, in interpret
>     handlers[opcode](self, args)
>   File "/home/zopes/Zope-3_ECM/src/zope/tal/talinterpreter.py", line
> 887, in do_useMacro
>     (`macroName`, `mode`), self.position)
> METALError: macro u'context/@@standard_macros/page' has incompatible
> mode 'html', at line 6, column 3
> 
> If I remove the xml header the error disappears.
> 
> It's really a huge problem because it means Zope3 'as it' can't render
> valid XML pages with standard macros...
> 
> Any idea how to fix thix problem without having to rewrite the standard
> macros ?
> 
> My use case is the inclusion of XForms within the Page Template and the
> mozilla plugin requires the page to be XML valid and thus to have the
> xml header.
> 
> Any hints welcome.
> 
> 	J.
> 
> 
> --
> Julien Anguenot | Nuxeo R&D (Paris, France)
> CPS Platform : http://www.cps-project.org
> Zope3 / ECM   : http://www.z3lab.org
> mail: anguenot at nuxeo.com; tel: +33 (0) 6 72 57 57 66
_______________________________________________
Zope3-dev mailing list
Zope3-dev at zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/ja%40nuxeo.com

- --
Julien Anguenot | Nuxeo R&D (Paris, France)
CPS Platform : http://www.cps-project.org
Zope3 / ECM   : http://www.z3lab.org
mail: anguenot at nuxeo.com; tel: +33 (0) 6 72 57 57 66
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iD8DBQFDFaQgGhoG8MxZ/pIRAkopAJ0dX5PAsk7Tb6+Z6Cai2jCXwfSBOwCffhpm
sa2nI5ZK2JjLa4ib/f7l+Lw=
=dPvJ
-----END PGP SIGNATURE-----


More information about the Zope3-dev mailing list