Wow! That's exactly what I need<br>
Tomorrow I'll try this<br><br>Thank you so much Tres!!!<br><br><div><span class="gmail_quote">2008/1/11, 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>Garito wrote:<br>> Hi, all!<br>> If you have download the ZSM product you could see I put on it a zexp<br>> file with prototype and some other js file and a css file plus images
<br>><br>> This was only a prototype solution to bring you the chance to see how<br>> my ideas are but I think this is not a definitive solution<br>><br>> Now my question:<br>><br>> Which is the best zope way to serve this kind of files trying to avoid
<br>> any other product dependence?<br>><br>> Thanks a lot!<br><br>In the context of Five / Zope3, the static content items are<br>"resources". One strategy would be to create a Zope2 product with those
<br>files in a subdirectory, e.g.::<br><br> $ mkdir Products/garito<br> $ cd Products/garito<br> $ echo "# ZSM product" > __init__.py<br> $ mkdir static<br> $ cat > static/garito.css<br> body {<br> background: #CCCCFF;
<br> }<br> ^D<br><br>And then register that directory as a "resource directory" via ZCML::<br><br> $ cat > configure.zcml<br> <configure xmlns:browser="<a href="http://namespaces.zope.org/browser">
http://namespaces.zope.org/browser</a>"><br> <browser:resourceDirectory<br> name="garito"<br> directory="static"<br> /><br> </configure><br> ^D<br><br>Now, when you start Zope2, you can pull in your static resources via
<br>special URLs, like <a href="http://localhost:8080/++resource++garito/garito.css">http://localhost:8080/++resource++garito/garito.css</a>::<br><br> $ cd ../..<br> $ bin/zopectl start<br> . daemon process started, pid=25240
<br> $ telnet localhost 8080<br> Trying 127.0.0.1...<br> Connected to localhost.<br> Escape character is '^]'.<br> GET /++resource++garito/garito.css HTTP/1.0<br><br> HTTP/1.0 200 OK<br> Server: Zope/(unreleased version, python
2.4.4, linux2) ZServer/1.1<br> Date: Fri, 11 Jan 2008 18:53:11 GMT<br> Content-Length: 32<br> Last-Modified: Fri, 11 Jan 2008 18:44:47 GMT<br> Connection: close<br> Cache-Control: public,max-age=86400<br> Content-Type: text/css; charset=iso-8859-15
<br><br> body {<br> background: #CCCCFF;<br> }<br> Connection closed by foreign host.<br><br>In that product, you could also register a template / browser view which<br>includes your resources, e.g::<br><br> $ cd Products/garito
<br> $ cat > <a href="http://garito.pt">garito.pt</a><br> <html><br> <head><br> <link rel="stylesheet" type="text/css"<br> href="/++resource++garito/garito.css"/>
<br> </head><br> <body><br> <h1> Garito's view </h1><br> </body><br> </html><br> ^D<br> $ cat > configure.zcml<br> <configure xmlns:browser="<a href="http://namespaces.zope.org/browser">
http://namespaces.zope.org/browser</a>"><br> <browser:page<br> for="*"<br> name="garito.html"<br> template="<a href="http://garito.pt">garito.pt</a>"<br> permission="
zope2.View"<br> /><br> <browser:resourceDirectory<br> name="garito"<br> directory="static"<br> /><br> </configure><br> ^D<br> $ cd ../..<br> $ bin/zopectl restart
<br> $ telnet localhost 8080<br> Trying 127.0.0.1...<br> Connected to localhost.<br> Escape character is '^]'.<br> GET /garito.html HTTP/1.0<br><br> HTTP/1.0 200 OK<br> Server: Zope/(unreleased version, python
2.4.4, linux2) ZServer/1.1<br> Date: Fri, 11 Jan 2008 19:02:05 GMT<br> Content-Length: 151<br> Content-Type: text/html; charset=iso-8859-15<br> Connection: close<br><br> <html><br> <head><br> <link rel="stylesheet" type="text/css"
<br> href="/++resource++garito/garito.css" /><br> </head><br> <body><br> <h1> Garito's view </h1><br> </body><br> </html><br> Connection closed by foreign host.
<br><br>Which pulls in your static resources.<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.6 (GNU/Linux)<br>Comment: Using GnuPG with Mozilla -
<a href="http://enigmail.mozdev.org">http://enigmail.mozdev.org</a><br><br>iD8DBQFHh72H+gerLs4ltQ4RAgwwAKDSJPrGAuwo++ShjWjZzyn06IDz1QCeK69s<br>+CIbgsCJkbRV5Tdh9XWEY9k=<br>=Du8x<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><br>Zope Smart Manager<br><a href="http://blogs.sistes.net/Garito/670">http://blogs.sistes.net/Garito/670
</a>