H Jansen wrote:
On Thu, 2005-06-02 at 23:48, Ivo van der Wijk wrote:

On 6/2/05, H Jansen <[EMAIL PROTECTED]> wrote:

I have build a very useful website in Zope2 in which I used the LocalFS
product for web access to my local file system. New to Zope3 I'm looking
for similar functionality.

I'd like to hear if anyone has dealt with this issue before in Zope3?
How should I go about it, will I have to go deep and start writing the
thing from scratch ... :sad:

I don't think there are any existing products that implement this, but
depending on what you want to store on this LocalFS, I think
implementation in Zope3 should be alot easier than with Zope2


Can you tell me step by step which implementation stages must/should be
addressed? At the moment I don't have the time to read the developers
handbook front to back, so your information may help me save a lot of
time. (I'm proficient with Python though.)


I'm cc'ing zope3-users since that is the list you should address problems like these to. zope3-dev is for the development of Zope 3 itself.

Expecting somebody else to work out the whole development cycle so that you can save yourself some time by not reading the docs is asking a lot. I'll just run down the basic idea here (pseudo-python-code), but you'll sooner or later have to read some docs when you run into errors and don't understand them.

1) Write a schema that holds the file name and specifies the methods you want to have working for the file. I presume you only need read():

class ILocalFile(Interface):

  filename = TextLine(...)

  def read():

2) Write a persistent implementation, something along the lines of:

class LocalFile(Persistent):

  def __init__(self, filename):
      self.filename = filename

  def read(self):
      return file(self.filename).read()

3) Make security assertions for the implementation

4) Write a browser view that serves the file:

class LocalFileView(BrowserView):

  def __call__(self):
      return self.context.read()

5) Register the browser view under index.html for ILocalFile

6) Register addmenu, addform, editform for ILocalFile

Zope3-users mailing list

Reply via email to