Re: [Zope3-Users] OOBtrees ZODB

2008-07-09 Thread Randy Crafton
Folder uses an OOBTree to store it's data, so it should be ok. But if you
want to use BTreeContainer and have it work as a Site, you just have the mix
the two together in a custom container class:

from zope.app.container.interfaces import IContainer
from zope.app.component.interfaces import IPossibleSite

class IMyFolder(IContainer, IPossibleSite):
My Custom Container

from zope.app.component.site import SiteManagerContainer
from zope.app.container import btree

class MyFolder(SiteManagerContainer, btree.BTreeContainer):
zope.interface.implements(IMyFolder)

Then the following should work:


if 'AR' not in root['Application']:
   root['Application']['AR']=MyFolder()
sm = LocalSiteManager(root['Application']['AR'])
   root['Application']['AR'].setSiteManager(sm)
   transaction.commit()


Randy



On Tue, Jul 8, 2008 at 11:10 AM, Tim Cook [EMAIL PROTECTED]
wrote:

 I am building a platform where I want to initialize the ZODB (that will
 be running under Zope) with three folders with sitemanagers.

 If I use Folders like this:

 if 'AR' not in root['Application']:
root['Application']['AR']=folder.Folder()
sm = LocalSiteManager(root['Application']['AR'])
root['Application']['AR'].setSiteManager(sm)
transaction.commit()

 it works great and I can then add initial objects to the folders.

 But, these folder sill potentially contain tens of thousands of objects
 so I really want to use BTree Folders.  But when I do this:

 from zope.app.container.btree import BTreeContainer

 ... lots of other stuff

 if 'AR' not in root['Application']:
root['Application']['AR']=BTreeContainer()
sm = LocalSiteManager(root['Application']['AR'])
root['Application']['AR'].setSiteManager(sm)
transaction.commit()

 I get this:

  File
 /home/tim/projects/ref_impl_python/TRUNK/oship/src/oship/atbldr/atbldr.py,
 line 78, in ?
root['Application']['AR'].setSiteManager(sm)
 AttributeError: 'BTreeContainer' object has no attribute
 'setSiteManager'

 So BtreeContainers don't have a siteManager.

 I would like to OOBTree but I have been unable to even discern the
 proper way to import it.

 Thanks.

 Tim





 --
 Timothy Cook, MSc
 Health Informatics Research  Development Services
 LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
 Skype ID == timothy.cook
 **
 *You may get my Public GPG key from  popular keyservers or   *
 *from this link http://timothywayne.cook.googlepages.com/home*
 **

 ___
 Zope3-users mailing list
 Zope3-users@zope.org
 http://mail.zope.org/mailman/listinfo/zope3-users


___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] OOBtrees ZODB

2008-07-09 Thread Tim Cook

On Wed, 2008-07-09 at 08:39 -0500, Randy Crafton wrote:
 Folder uses an OOBTree to store it's data, so it should be ok.

Thanks.  I believe that solves my issue.  :-)

  But if you want to use BTreeContainer and have it work as a Site, you
 just have the mix the two together in a custom container class:

Is there some advantage to jumping through that hoop? 
I just want to be sure that my container will be able to handle a large
(20,000+) number of objects.

Cheers,
Tim


-- 
**
Join the OSHIP project.  It is the standards based, open source
healthcare application platform in Python.
Home page: https://launchpad.net/oship/ 
Wiki: http://www.openehr.org/wiki/display/dev/Python+developer%27s+page 
**


signature.asc
Description: This is a digitally signed message part
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] OOBtrees ZODB

2008-07-08 Thread Shailesh Kumar
BTreeContainer doesn't support site managers.

Folder is a subclass of SiteManagerContainer which is a subclass of
BTreeContainer.

You can happily use Folder here.

With regards,
- Shailesh



On 7/8/08, Tim Cook [EMAIL PROTECTED] wrote:

 I am building a platform where I want to initialize the ZODB (that will
 be running under Zope) with three folders with sitemanagers.

 If I use Folders like this:

 if 'AR' not in root['Application']:
root['Application']['AR']=folder.Folder()
sm = LocalSiteManager(root['Application']['AR'])
root['Application']['AR'].setSiteManager(sm)
transaction.commit()

 it works great and I can then add initial objects to the folders.

 But, these folder sill potentially contain tens of thousands of objects
 so I really want to use BTree Folders.  But when I do this:

 from zope.app.container.btree import BTreeContainer

 ... lots of other stuff

 if 'AR' not in root['Application']:
root['Application']['AR']=BTreeContainer()
sm = LocalSiteManager(root['Application']['AR'])
root['Application']['AR'].setSiteManager(sm)
transaction.commit()

 I get this:

 File
 /home/tim/projects/ref_impl_python/TRUNK/oship/src/oship/atbldr/atbldr.py,
 line 78, in ?
root['Application']['AR'].setSiteManager(sm)
 AttributeError: 'BTreeContainer' object has no attribute
 'setSiteManager'

 So BtreeContainers don't have a siteManager.

 I would like to OOBTree but I have been unable to even discern the
 proper way to import it.

 Thanks.

 Tim





 --
 Timothy Cook, MSc
 Health Informatics Research  Development Services
 LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
 Skype ID == timothy.cook
 **
 *You may get my Public GPG key from  popular keyservers or   *
 *from this link http://timothywayne.cook.googlepages.com/home*
 **

 ___
 Zope3-users mailing list
 Zope3-users@zope.org
 http://mail.zope.org/mailman/listinfo/zope3-users



___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] OOBtrees ZODB

2008-07-08 Thread Tim Cook

On Tue, 2008-07-08 at 09:31 -0700, Shailesh Kumar wrote:
 BTreeContainer doesn't support site managers.
  
 Folder is a subclass of SiteManagerContainer which is a subclass of
 BTreeContainer.
  
 You can happily use Folder here.
  

Thanks.  I hadn't noticed that.  In the earlier days of Zope2, Folder
was kind of weak with large numbers of objects.


Cheers,
Tim





signature.asc
Description: This is a digitally signed message part
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users