Implement __dir__ in ObjectStore

master
Harald Wolff 2018-03-12 09:26:53 +01:00
parent 10246f0713
commit 4687f34d9d
1 changed files with 8 additions and 0 deletions

View File

@ -10,6 +10,14 @@ class DiscObjectStore:
if not os.path.exists( self._path ):
os.makedirs( self._path )
def __dir__(self):
fl = os.listdir(self._path)
l = []
for f in fl:
if not f.startswith("."):
l.append(f)
return l
def __contains__(self, name):
return os.path.exists( "%s/%s" % (self._path, name))