Merge branch '2.5.x' into 2.5.x-saas

This commit is contained in:
Albert Santoni 2014-01-31 13:21:33 -05:00
commit c7c2d37b30
35 changed files with 2876 additions and 1657 deletions

View file

@ -114,7 +114,13 @@ def clean_empty_dirs(path):
full_paths = ( os.path.join(root, d) for d in dirs )
for d in full_paths:
if os.path.exists(d):
if not os.listdir(d): os.removedirs(d)
#Try block avoids a race condition where a file is added AFTER listdir
#is run but before removedirs. (Dir is not empty and removedirs throws
#an exception in that case then.)
try:
if not os.listdir(d): os.rmdir(d)
except OSError:
pass
def extension(path):
"""