[Calypso-commits] [calypso] 01/01: Use listdir rather than glob.

Jelmer Vernooij jelmer at moszumanska.debian.org
Sat Apr 9 23:29:17 UTC 2016


This is an automated email from the git hooks/post-receive script.

jelmer pushed a commit to branch master
in repository calypso.

commit e7d713be18f20ef53a6271306baddb88cd68c2e0
Author: Jelmer Vernooij <jelmer at jelmer.uk>
Date:   Sat Apr 9 11:37:49 2016 +0000

    Use listdir rather than glob.
---
 calypso/webdav.py | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/calypso/webdav.py b/calypso/webdav.py
index c6f9a0d..0299c7a 100644
--- a/calypso/webdav.py
+++ b/calypso/webdav.py
@@ -30,7 +30,6 @@ import os
 import codecs
 import time
 import hashlib
-import glob
 import logging
 import tempfile
 import vobject
@@ -299,25 +298,26 @@ class Collection(object):
             return
         self.log.debug("Scan %s", self.path)
         self.mtime = mtime
-        filenames = glob.glob(self.pattern)
+        filenames = os.listdir(self.path)
         newfiles = []
         for filename in filenames:
             if filename == METADATA_FILENAME:
                 continue
+            filepath = os.path.join(self.path, filename)
             for file in self.files:
-                if filename == file.path:
+                if filepath == file.path:
                     newfiles.append(file)
                     if not file.is_up_to_date():
-                        self.log.debug("Changed %s", filename)
-                        self.scan_file(filename)
+                        self.log.debug("Changed %s", filepath)
+                        self.scan_file(filepath)
                     break
             else:
-                if os.path.isdir(filename):
-                    self.log.debug("Ignoring directory %s in scan_dir", filename)
+                if os.path.isdir(filepath):
+                    self.log.debug("Ignoring directory %s in scan_dir", filepath)
                 else:
-                    self.log.debug("New %s", filename)
-                    newfiles.append(Pathtime(filename))
-                    self.insert_file(filename)
+                    self.log.debug("New %s", filepath)
+                    newfiles.append(Pathtime(filepath))
+                    self.insert_file(filepath)
         for file in self.files:
             if not file.path in filenames:
                 self.log.debug("Removed %s", file.path)
@@ -336,7 +336,6 @@ class Collection(object):
         self.urlpath = path
         self.owner = paths.url_to_owner(path)
         self.path = paths.url_to_file(path)
-        self.pattern = os.path.join(self.path, "*")
         self.files = []
         self.my_items = []
         self.mtime = 0

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/calypso/calypso.git



More information about the Calypso-commits mailing list