Access to the root directory or any other non-leaf directory raises a

IOError: [Errno 21] Is a directory: '.../.config/calypso/calendars/...'

which is caught and logged as an exception, but still shows even though
just a file-oriented function is called in scan_dir with a subdirectory.
Instead, now, a debug-level log message is emitted on directories that
they are ignored for the purpose of scan_dir.
---
seeing tracebacks in the log is distracting during development,
especially when there is not really an error.

 calypso/webdav.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/calypso/webdav.py b/calypso/webdav.py
index 12a9817..4d67db4 100644
--- a/calypso/webdav.py
+++ b/calypso/webdav.py
@@ -287,9 +287,12 @@ class Collection(object):
                         self.scan_file(filename)
                     break
             else:
-                self.log.debug("New %s", filename)
-                newfiles.append(Pathtime(filename))
-                self.insert_file(filename)
+                if os.path.isdir(filename):
+                    self.log.debug("Ignoring directory %s in scan_dir", 
filename)
+                else:
+                    self.log.debug("New %s", filename)
+                    newfiles.append(Pathtime(filename))
+                    self.insert_file(filename)
         for file in self.files:
             if not file.path in filenames:
                 self.log.debug("Removed %s", file.path)
-- 
2.7.0

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Calypso mailing list
[email protected]
http://keithp.com/mailman/listinfo/calypso

Reply via email to