[Zope-dev] Need Help: Can I use Folder w/Customizer to implement a ImapClient ???

Ulrich Eck ueck@net-labs.de
Thu, 15 Mar 2001 16:20:49 +0100


hi ZPattern-Freaks out there,

i want to write an ImapClient for CyrusImap as Zope-Product.
- Handle several Mailboxes
- Use Zope-Management for IMAP-Folder-Management and ACL/Security
- Use Custom-Interface as Mailclient

The Final Structue I want to have. It should act like a standart Zope
Folder-Tree:

- ImapClient ( holds Connection-Objects toIMAP-Mailboxes, Storage=ZODB)
  |- ImapRootFolder ( Connection-Object and Root-Folder , Storage=ZODB)
  |  |-ImapFolder (a folder  on the imapserver, not persitantly stored)
  |  |   |-ImapFolder (..)
  |  |   |   | ...
  |  |   |-ImapMessage (a message on the imapserver, not persitantly stored)
  |  |-ImapMessage (..)
  |- ImapRootFolder (..)
  |  |-ImapFolder (..)
  |  |   |-ImapFolder (..)
  |  |   |   | ...
  |  |   |-ImapMessage (..)
  |  |-ImapMessage (..)


after big thougths about whether to use an Implementation like
- ZLDAPConnection
  * A Root Connection Object
     class ZLDAPConnection (Acquisition.Implicit,Persistent,
OFS.SimpleItem.Item,...)
  * the nodes ar stored in a Tree of Entries
     class Entry(Acquisition.Implicit,OFS.SimpleItem.Item)
or LocalFS does quite the same ...

BUT:
I want to be able to "skin" every meta_type separately, but I cannot just
use Acquisition because
of duplicates like "index_html"
-------------------

- Use a Specialist
AFAIK a Rack can only serve one meta-type
It's hard to implement the Folder Structure in racks
-------------------

- Use a Folder w/Customizer

this pretty looks like the one to use ...

but phillip told me some time ago,that
I can use it only with persistant ZODB-Storage like other zope-objects -
just use Dataskins with factory.

So I decided to give it a try.

I now have an ImapClient (CustomizerFolder)
which stores ImapRootFolder(Dataskin,Acquisition.Implicit,Folder)
the RootFolder emulates an ObjectManager to serve the Folders
retrieved from the IMAP-Server.

The ImapFolder-Objects are stored in an Attribute Children which is a List.

and are created like this:

def IMAPFolderFactory(client,Name,FullName="", PaddedName=""):
     handle = ImapDataSkins.ImapFolder(Name)
     handle._setRack(client.aq_inner.aq_parent._getDataManagerFor(handle))
     handle.__dict__['_rackMounted'] = 0
     handle = handle.__of__(client)
     handle.setup(Name,FullName,PaddedName)
     return handle

Now I have an Tree I can browse in the ZMI ... BUT ...

"I lose contact to Zope" when i browse down into the
first object wich is not persistantly stored.
I allthough don't get the "mapped Attributes/Methods" from the Customizer.

Is there a possiblity to use the CustomizerFolder with not ZODB-Objects
- What Methods need to be implemented that this could work

any help appreciated .. don't want to stop halfway ;-) ..

thanks Ulrich Eck