Changeset - 502f0d532fd0
[Not reviewed]
default
0 1 0
drewp@bigasterisk.com - 12 years ago 2013-06-15 07:16:11
drewp@bigasterisk.com
try harder not to lose notifications on a file after one edit in emacs
Ignore-this: a1dc276d1f953ec9978a10e9744c674a
1 file changed with 2 insertions and 1 deletions:
0 comments (0 inline, 0 general)
light9/rdfdb/graphfile.py
Show inline comments
 
@@ -55,12 +55,13 @@ class GraphFile(object):
 

	
 
        from twisted.internet.inotify import IN_CLOSE_WRITE, IN_MOVED_FROM, IN_MODIFY, IN_DELETE, IN_DELETE_SELF, IN_CHANGED
 

	
 
        notifier.watch(FilePath(path), callbacks=[self.notify])
 
      
 
    def notify(self, notifier, filepath, mask):
 
        try:
 
        maskNames = humanReadableMask(mask)
 
        if maskNames[0] == 'delete_self':
 
            if not filepath.exists():
 
                log.info("%s delete_self", filepath)
 
                self.fileGone()
 
                return
 
@@ -81,13 +82,13 @@ class GraphFile(object):
 
                return
 
        except OSError as e:
 
            log.error("%s: %r" % (filepath, e))
 
            return
 
            
 
        log.info("%s needs reread because of %s event", filepath, maskNames)
 
        try:
 

	
 
            self.reread()
 
        except Exception:
 
            traceback.print_exc()
 

	
 
    def fileGone(self):
 
        """
0 comments (0 inline, 0 general)