ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> zope-List
zope-List
[Zope] CMFCore.DirectoryView
by Elena Schulz other posts by this author
Dec 30 2002 2:00PM messages near this date
Re: [Zope] mount backup ZODB (readonly) | Re: [Zope] CMFCore.DirectoryView
Hi,

I try to connect ZPT to my local Filesytem. Previouesly I used localFS and
DTML which worked nicely. But according to an earlier post by Dieter I
learned that I should use DirectoryView from the CMFCore now.

But thats not so easy as I found.
Does the registration have to be done on every serverstart again? (How to
automate it if so?)
How to add new extensions and metatypes?

Up to now I succeeded to register an arbitrary Directory on my local FS and
different MetaTypes with the external Method given below. But a
corresponding klass has to be given for the registration. How to do that
using classes like the 'FSObject' return bad file error when I try to view
the object in ZMI.

Does anybody know about that? (Or how to use local FS under ZPT?)

-- many thanks for your replies, Elena


the code:

from Products.CMFCore import FSObject
from Products.CMFCore import DirectoryView
DV=DirectoryView

def registerLocalDir (my_dir='my_absolute_FS_path', prefix="",
extList=['css', 'js'], metaList=['Style Sheet'], subdirs=0):

 DV.registerDirectory(my_dir, prefix, subdirs)
 klass=FSObject
 for ext in extList:
  DV.registerFileExtension(ext, klass)
 for mt in metaList:
  DV.registerMetaType(mt, klass)
 return



_______________________________________________
Zope maillist  -  Zope@[...].org
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )
Thread:
Elena Schulz
Elena Schulz
Dieter Maurer
Janko Hauser
Elena Schulz
Dieter Maurer
Dieter Maurer

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved