Sorry Tres but your solution is not so much minimalistic as I spect<br><br>I prefer the Gaël solution but I don'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 <<a href="mailto:tseaver@palladion.com">tseaver@palladion.com</a>>:</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>> Hello Garito!<br>><br>> Sun, 8 Apr 2007 16:48:14 +0200, you wrote:<br>><br>> > Hi!!<br>> > I have a method in my product called freemind wich generate the xml to the
<br>> > freemind applet but on this applet is mandatory to use the .mm extension<br>><br>> > Is possible to create a product function with extension? (in this case will<br>> > be something like <a href="http://freemind.mm">
freemind.mm</a>)<br>><br>> You could do it with a dirty setattr(self, "<a href="http://myfunction.mm">myfunction.mm</a>", self.myfunction).<br>><br>> But I would say the cleanest way is to use the Content-Disposition HTTP header:
<br>><br>> Content-Disposition: attachment; filename=<a href="http://myfunction.mm">myfunction.mm</a><br>><br>> (with REQUEST.RESPONSE.setHeader).<br>><br>> See <a href="http://www.ietf.org/rfc/rfc1806.txt">
http://www.ietf.org/rfc/rfc1806.txt</a> for more information on it.<br>><br><br>You could also register a browser view which uses your method. E.g.,<br>to implement the view::<br><br> # Produts/foo/browser.py<br> from
Products.Five import BrowserView<br> class FreemindView(BrowserView):<br> def __call__(self, *args, **kw):<br> self.request.RESPONSE.setHeader('Content-Type', 'text/xml')<br> return
self.context.freemind()<br><br>and then register the view<br><br> <!-- Products/foo/configure.zcml --><br> <configure xmlns="<a href="http://namespaces.zope.org/zope">http://namespaces.zope.org/zope</a>"
<br> xmlns:browser="<a href="http://namespaces.zope.org/browser">http://namespaces.zope.org/browser</a>"><br><br> <browser:page<br> for=".interfaces.IFreemindProvider"<br> name="
<a href="http://freemind.mm">freemind.mm</a>"<br> class=".browser.FreemindView"<br> permission="zope.Public"<br> /><br><br>The registration assumes that your content class implements an
<br>'IFreemindProvider' view, which might be defined as:<br><br> # Products/foo/interfaces.py<br> from zope.interface import Interface<br> class IFreemindProvider(Interface):<br> """ Document it here.
<br> """<br> def freemind():<br> """ Document the method here.<br> """<br><br>Your content class would then declare that it implements it, e.g.:<br>
<br> # Products/foo/content.py<br> from zope.interface import implements<br> from Products.foo.interfaces import IFreemindProvider<br><br> class FooContent(...):<br> implements(IFreemindProvider)<br> ....<br>
<br><br>Once set up this way, assuming that yo have a FooContext instance with<br>the URL, '<a href="http://example.com/path/to/foo">http://example.com/path/to/foo</a>', then you could point the<br>browser to '
<a href="http://example.com/path/to/foo/freemind.mm">http://example.com/path/to/foo/freemind.mm</a>' to get the XML.<br><br><br><br>Tres.<br>- --<br>===================================================================<br>
Tres Seaver +1 540-429-0999 <a href="mailto:tseaver@palladion.com">tseaver@palladion.com</a><br>Palladion Software "Excellence by Design" <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 - <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>** No cross posts or HTML encoding! **<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>