[Zope] Accessing ZODB contents in an external method?

Kapil Thangavelu hazmat at objectrealms.net
Sat Mar 13 18:21:36 EST 2004


On Fri, 2004-03-12 at 13:49, Edward Pollard wrote:
> I need to run a report that is basically "What files are in this 
> directory?"
> 
> This directory now lives in the ZODB.
> 
> Is there anyway to talk to the ZODB from an external method?
> 


the self parameter to an external method provides a context back to the
zodb..

def report(self):
    files = self.objectIds('File')
    return files

if you meant fs directory than your question is worded poorly

import os

def report(self, dirname):
    path = os.path.join( os.environ['INSTANCE_HOME'], 'var',
dirname)     
    if not os.path.exist( path ): return None
    return  os.listdir( path )

hth,
-kapil




More information about the Zope mailing list