Sorry Tres but your solution is not so much minimalistic as I spect<br><br>I prefer the Gaël solution but I don&#39;t understand so much<br><br>Where do I need to put this line? At my product code? Where, please?<br><br>Thanks both!!!!!!!
<br><br><div><span class="gmail_quote">2007/4/9, Tres Seaver &lt;<a href="mailto:tseaver@palladion.com">tseaver@palladion.com</a>&gt;:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
-----BEGIN PGP SIGNED MESSAGE-----<br>Hash: SHA1<br><br>Gaël Le Mignot wrote:<br>&gt; Hello Garito!<br>&gt;<br>&gt; Sun, 8 Apr 2007 16:48:14 +0200, you wrote:<br>&gt;<br>&gt;&nbsp;&nbsp;&gt; Hi!!<br>&gt;&nbsp;&nbsp;&gt; I have a method in my product called freemind wich generate the xml to the
<br>&gt;&nbsp;&nbsp;&gt; freemind applet but on this applet is mandatory to use the .mm extension<br>&gt;<br>&gt;&nbsp;&nbsp;&gt; Is possible to create a product function with extension? (in this case will<br>&gt;&nbsp;&nbsp;&gt; be something like <a href="http://freemind.mm">
freemind.mm</a>)<br>&gt;<br>&gt; You could do it with a dirty setattr(self, &quot;<a href="http://myfunction.mm">myfunction.mm</a>&quot;, self.myfunction).<br>&gt;<br>&gt; But I would say the cleanest way is to use the Content-Disposition&nbsp;&nbsp;HTTP header:
<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-Disposition: attachment; filename=<a href="http://myfunction.mm">myfunction.mm</a><br>&gt;<br>&gt; (with REQUEST.RESPONSE.setHeader).<br>&gt;<br>&gt; See <a href="http://www.ietf.org/rfc/rfc1806.txt">
http://www.ietf.org/rfc/rfc1806.txt</a> for more information on it.<br>&gt;<br><br>You could also register a browser view which uses your method. E.g.,<br>to implement the view::<br><br>&nbsp;&nbsp; # Produts/foo/browser.py<br>&nbsp;&nbsp; from 
Products.Five import BrowserView<br>&nbsp;&nbsp; class FreemindView(BrowserView):<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; def __call__(self, *args, **kw):<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.request.RESPONSE.setHeader(&#39;Content-Type&#39;, &#39;text/xml&#39;)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return 
self.context.freemind()<br><br>and then register the view<br><br>&nbsp;&nbsp;&lt;!-- Products/foo/configure.zcml --&gt;<br>&nbsp;&nbsp;&lt;configure xmlns=&quot;<a href="http://namespaces.zope.org/zope">http://namespaces.zope.org/zope</a>&quot;
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xmlns:browser=&quot;<a href="http://namespaces.zope.org/browser">http://namespaces.zope.org/browser</a>&quot;&gt;<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;browser:page<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for=&quot;.interfaces.IFreemindProvider&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; name=&quot;
<a href="http://freemind.mm">freemind.mm</a>&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; class=&quot;.browser.FreemindView&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; permission=&quot;zope.Public&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /&gt;<br><br>The registration assumes that your content class implements an
<br>&#39;IFreemindProvider&#39; view, which might be defined as:<br><br>&nbsp;&nbsp;# Products/foo/interfaces.py<br>&nbsp;&nbsp;from zope.interface import Interface<br>&nbsp;&nbsp;class IFreemindProvider(Interface):<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;&quot;&quot; Document it here.
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;&quot;&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;def freemind():<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;&quot;&quot; Document the method here.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;&quot;&quot;<br><br>Your content class would then declare that it implements it, e.g.:<br>
<br>&nbsp;&nbsp;# Products/foo/content.py<br>&nbsp;&nbsp;from zope.interface import implements<br>&nbsp;&nbsp;from Products.foo.interfaces import IFreemindProvider<br><br>&nbsp;&nbsp;class FooContent(...):<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;implements(IFreemindProvider)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;....<br>
<br><br>Once set up this way, assuming that yo have a FooContext instance with<br>the URL, &#39;<a href="http://example.com/path/to/foo">http://example.com/path/to/foo</a>&#39;, then you could point the<br>browser to &#39;
<a href="http://example.com/path/to/foo/freemind.mm">http://example.com/path/to/foo/freemind.mm</a>&#39; to get the XML.<br><br><br><br>Tres.<br>- --<br>===================================================================<br>
Tres Seaver&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+1 540-429-0999&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="mailto:tseaver@palladion.com">tseaver@palladion.com</a><br>Palladion Software&nbsp;&nbsp; &quot;Excellence by Design&quot;&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://palladion.com">http://palladion.com
</a><br>-----BEGIN PGP SIGNATURE-----<br>Version: GnuPG v1.4.2.2 (GNU/Linux)<br>Comment: Using GnuPG with Mozilla - <a href="http://enigmail.mozdev.org">http://enigmail.mozdev.org</a><br><br>iD8DBQFGGXdB+gerLs4ltQ4RAjlAAKCeXBZIYWcL1bHM6vjmnaEzznGvSQCeNCld
<br>qCeaE8441MRetKfmNwrhnP0=<br>=Uzxy<br>-----END PGP SIGNATURE-----<br><br>_______________________________________________<br>Zope maillist&nbsp;&nbsp;-&nbsp;&nbsp;<a href="mailto:Zope@zope.org">Zope@zope.org</a><br><a href="http://mail.zope.org/mailman/listinfo/zope">
http://mail.zope.org/mailman/listinfo/zope</a><br>**&nbsp;&nbsp; No cross posts or HTML encoding!&nbsp;&nbsp;**<br>(Related lists -<br> <a href="http://mail.zope.org/mailman/listinfo/zope-announce">http://mail.zope.org/mailman/listinfo/zope-announce
</a><br> <a href="http://mail.zope.org/mailman/listinfo/zope-dev">http://mail.zope.org/mailman/listinfo/zope-dev</a> )<br></blockquote></div><br><br clear="all"><br>-- <br>Mis Cosas<br><a href="http://blogs.sistes.net/Garito">
http://blogs.sistes.net/Garito</a>