On 2004-03-10 10:14 AM, Chris Withers is reputed to have said:
Ian Beatty wrote:
I've been messing around with DTMLFile and ClassicHTMLFile and the like, haven't been able to figure out how to get it to work for arbitrary paths. They also require all my file names end in '.dtml', which is quite a pain.
Any suggestions?
Local FS? What Sandor said? Apache and rewrite rules?
I'm overriding '__getitem__' and using Python's "os" package to directly access the local file system. I just sniff the file name extension and set the response content-type, then return the contents of the named file. Simple and stupid. I actually delegate the file-serving to a helper class, and use recursion to handle arbitrary-length paths for arbitrary-depth file system hierarchies. Simple, stupid, and inelegant, but it seems to work. FileSystemSite seemed geared towards providing ZMI access to static files. I just want my product to be able to dish out preset files that are part of the product. (If anyone's curious, I'm using a Zope product for a back-end to a Mozilla/XUL front-end. This static file stuff allows the product to provide the XUL, JavaScript, and CSS files needed to define the Mozilla-based interface.) Thanks for all the suggestions. Cheers, ..Ian -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- Dr. Ian Beatty beatty@physics.umass.edu Physics Education Research Group voice: 413.545.9483 Department of Physics fax: 413.545.4884 Univ. of Massachusetts AIM: (available upon request) Amherst, MA 01003-4525 USA http://umperg.physics.umass.edu/ -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- --