Commit 874e2d54 authored by Christophe Dumez's avatar Christophe Dumez

- moved cacheWalk (os.path.walk modification) for copyright concern


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@7415 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 8119ea92
...@@ -50,6 +50,7 @@ from xml.sax.saxutils import escape ...@@ -50,6 +50,7 @@ from xml.sax.saxutils import escape
from dircache import listdir from dircache import listdir
from OFS.Traversable import NotFound from OFS.Traversable import NotFound
from Products.ERP5Type.copyTree import copytree from Products.ERP5Type.copyTree import copytree
from Products.ERP5Type.cacheWalk import cacheWalk
try: try:
from base64 import b64encode, b64decode from base64 import b64encode, b64decode
...@@ -136,40 +137,6 @@ class SubversionNotAWorkingCopyError(Exception): ...@@ -136,40 +137,6 @@ class SubversionNotAWorkingCopyError(Exception):
""" """
pass pass
def cacheWalk(top, topdown=True, onerror=None):
"""Directory tree generator.
modification of os.path.walk to use dircache.listdir
instead of os.path.listdir
Copyright (c) 2001, 2002, 2003, 2004 Python Software Foundation; All Rights Reserved
"""
try:
# Note that listdir and error are globals in this module due
# to earlier import-*.
names = listdir(top)
except os.error, err:
if onerror is not None:
onerror(err)
return
dirs, nondirs = [], []
for name in names:
if os.path.isdir(os.path.join(top, name)):
dirs.append(name)
else:
nondirs.append(name)
if topdown:
yield top, dirs, nondirs
for name in dirs:
path = os.path.join(top, name)
if not os.path.islink(path):
for elem in cacheWalk(path, topdown, onerror):
yield elem
if not topdown:
yield top, dirs, nondirs
def colorizeTag(tag): def colorizeTag(tag):
"Return html colored item" "Return html colored item"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment