summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastien Martini <seb@dbzteam.org>2010-05-17 21:16:22 +0200
committerSebastien Martini <seb@dbzteam.org>2010-05-17 21:16:22 +0200
commite9751bfbaf9a514f76b52ee0290497675e6d67e3 (patch)
tree36b80d337c1682653179c5c433cd321f2828163d
parent4ff4c0f2bb0092da4655f29fb76c5a74c0bf2071 (diff)
downloadpyinotify-e9751bfbaf9a514f76b52ee0290497675e6d67e3.tar.gz
Fixed previous fix f7510650b8e9950247d14841967eb64d0b2d0294.
-rwxr-xr-xpython2/pyinotify.py12
-rwxr-xr-xpython3/pyinotify.py12
2 files changed, 14 insertions, 10 deletions
diff --git a/python2/pyinotify.py b/python2/pyinotify.py
index ababd1e..128ed5e 100755
--- a/python2/pyinotify.py
+++ b/python2/pyinotify.py
@@ -602,22 +602,24 @@ class _SysProcessEvent(_ProcessEvent):
addw = self._watch_manager.add_watch
# The newly monitored directory inherits attributes from its
# parent directory.
- newwd = addw(created_dir, watch_.mask, proc_fun=watch_.proc_fun,
- rec=False, auto_add=watch_.auto_add,
- exclude_filter=watch_.exclude_filter)
+ addw_ret = addw(created_dir, watch_.mask,
+ proc_fun=watch_.proc_fun,
+ rec=False, auto_add=watch_.auto_add,
+ exclude_filter=watch_.exclude_filter)
# Trick to handle mkdir -p /t1/t2/t3 where t1 is watched and
# t2 and t3 are created.
# Since the directory is new, then everything inside it
# must also be new.
- if newwd[created_dir] > 0:
+ created_dir_wd = addw_ret.get(created_dir)
+ if (created_dir_wd is not None) and created_dir_wd > 0:
for name in os.listdir(created_dir):
inner = os.path.join(created_dir, name)
if (os.path.isdir(inner) and
self._watch_manager.get_wd(inner) is None):
# Generate (simulate) creation event for sub
# directories.
- rawevent = _RawEvent(newwd[created_dir],
+ rawevent = _RawEvent(created_dir_wd,
IN_CREATE | IN_ISDIR,
0, name)
self._notifier.append_event(rawevent)
diff --git a/python3/pyinotify.py b/python3/pyinotify.py
index 061231c..b670e15 100755
--- a/python3/pyinotify.py
+++ b/python3/pyinotify.py
@@ -566,22 +566,24 @@ class _SysProcessEvent(_ProcessEvent):
addw = self._watch_manager.add_watch
# The newly monitored directory inherits attributes from its
# parent directory.
- newwd = addw(created_dir, watch_.mask, proc_fun=watch_.proc_fun,
- rec=False, auto_add=watch_.auto_add,
- exclude_filter=watch_.exclude_filter)
+ addw_ret = addw(created_dir, watch_.mask,
+ proc_fun=watch_.proc_fun,
+ rec=False, auto_add=watch_.auto_add,
+ exclude_filter=watch_.exclude_filter)
# Trick to handle mkdir -p /t1/t2/t3 where t1 is watched and
# t2 and t3 are created.
# Since the directory is new, then everything inside it
# must also be new.
- if newwd[created_dir] > 0:
+ created_dir_wd = addw_ret.get(created_dir)
+ if (created_dir_wd is not None) and created_dir_wd > 0:
for name in os.listdir(created_dir):
inner = os.path.join(created_dir, name)
if (os.path.isdir(inner) and
self._watch_manager.get_wd(inner) is None):
# Generate (simulate) creation event for sub
# directories.
- rawevent = _RawEvent(newwd[created_dir],
+ rawevent = _RawEvent(created_dir_wd,
IN_CREATE | IN_ISDIR,
0, name)
self._notifier.append_event(rawevent)