[Seaside] static image files

Philippe Marschall philippe.marschall at gmail.com
Fri Apr 21 23:17:07 UTC 2006


2006/2/9, Avi Bryant <avi.bryant at gmail.com>:
>
> On Feb 8, 2006, at 3:34 AM, Lukas Renggli wrote:
>
> > Ohh, I think I already asked for that several times and even proposed
> > possible solutions, like to give more power to WAStringLibrary and to
> > make it a subclass of a WAFileLibrary class so that CSS, JavaScript
> > and Images can go toerether and reference each-other... but I got no
> > answer.
>
> I think it's a good idea, but I don't personally have my head around
> how this would work.  It would probably be easier to discuss if there
> were some proof of concept implementation to play with...

Ok, here we go. Have a look at FileLibrary in the seaside repository.
The basic idea:
- We have a new type of application (WAFileHandler) that serves static
files from libraries.
- A library is a Sublass of WAFileLibrary.
- A file is a method in a library that returns a String or a ByteArray
(or something else that understands #asMIMEDocument).
- The filename is created by the convention the selector is the
filename plus the capitalized exention. So for example #mainCss
becomes 'main.css'. This allows you to reference files from other
files.
- Mimetypes are guessed by the extension.
- WAStyle/ScriptLibraries are supported too. In their case '.css' or
'.js' is added to their selectors.
- There is a config interface for all this (application type is
'Static File Library') that allows you to configure all this stuff,
even upload files.
- There are methods on the class side of WAFileLibrary that allow you
to programmaticall add files to your library (or whole directories)
- there are tests

No Sessions, no weak*, no continutions, no redirects, no filesystem
access, no ...

Cheers
Philippe


More information about the Seaside mailing list