Ficus
  • Overview
  • Repository
  • Tickets
  • Statistics
  • Projects

Repository

Call non-decorated variants of functions on callbacks

Parent commits : 79bfef3fdbdaf8e6868dfa4fedc749f417429395,
Children commits : 5d37bfec5fe62cad36627d4eed52b6b005f9e299,

By Laurent Defert on 2012-10-12 16:47:54
Call non-decorated variants of functions on callbacks

Browse content
Difference with parent commit 79bfef3fdbdaf8e6868dfa4fedc749f417429395
Files modified:
ficus/ficus_client.py
--- 
+++ 
@@ -139,6 +139,9 @@
 
     @bin_cmd_arg_types(int, normpath)
     def cmd_dir(self, node_len, path, data):
+        self.dir(node_len, path, data)
+
+    def dir(self, node_len, path, data):
         node = data[:node_len]
         content = data[node_len:]
 
@@ -150,7 +153,7 @@
             parent, filename = self.fs.get_parent(path)
             if not self.fs.has_file(parent):
                 logging.debug('Parent (%s) has been modified, reretrieving it to modify it' % parent)
-                self.dretrieve_dir(parent, lambda: self.cmd_dir(node_len, path, data))
+                self.dretrieve_dir(parent, lambda: self.dir(node_len, path, data))
                 return
 
             owners = self.get_owners(parent)
@@ -229,7 +232,10 @@
 
     @cmd_arg_types(normpath)
     def cmd_dget_dir(self, full_path):
-        if not self.dretrieve_dir(full_path, lambda: self.cmd_dget_dir(full_path)):
+        self.dget_dir(full_path)
+
+    def dget_dir(self, full_path):
+        if not self.dretrieve_dir(full_path, lambda: self.dget_dir(full_path)):
             return
         self.cmd_get_dir(full_path)
 
@@ -247,6 +253,9 @@
 
     @cmd_arg_types(normpath)
     def cmd_drmdir(self, path):
+        self.drmdir(path)
+
+    def drmdir(self, path):
         if path == '/':
             logging.error('Trying to rmdir /')
             return
@@ -256,7 +265,7 @@
         for required_file in (parent, path):
             if not self.fs.has_file(required_file):
                 logging.debug('doing get_dir before rmdir')
-                self.dretrieve_dir(required_file, lambda: self.cmd_drmdir(path))
+                self.dretrieve_dir(required_file, lambda: self.drmdir(path))
                 return
 
         # Remove the dir locally
@@ -280,6 +289,9 @@
 
     @cmd_arg_types(normpath, int, int, int)
     def cmd_dmknod(self, path, mode, gid, uid):
+        self.dmknod(path, mode, gid, uid)
+
+    def dmknod(self, path, mode, gid, uid):
         if (not mode & stat.S_IFREG) \
            and (not mode & stat.S_IFDIR):
             logging.error('Trying to create a file with invalid mode: %s', oct(mode))
@@ -293,7 +305,7 @@
 
         if not self.fs.has_file(parent):
             logging.debug('doing get_dir before dmknod')
-            self.dretrieve_dir(parent, lambda: self.cmd_dmknod(path, mode, gid, uid))
+            self.dretrieve_dir(parent, lambda: self.dmknod(path, mode, gid, uid))
             return
 
         # Create the dir locally
@@ -318,22 +330,28 @@
     @cmd_arg_types(normpath, int, int, int)
     def cmd_dmkdir(self, path, mode, gid, uid):
         mode |= stat.S_IFDIR
-        self.cmd_dmknod(path, mode, gid, uid)
+        self.dmknod(path, mode, gid, uid)
 
     @cmd_arg_types(normpath)
     def cmd_dget_node(self, path):
-        if not self.dretrieve_dir(path, lambda: self.cmd_dget_node(path)):
+        self.dget_node(path)
+
+    def dget_node(self, path):
+        if not self.dretrieve_dir(path, lambda: self.dget_node(path)):
             return
         self.cmd_get_node(path)
 
     @cmd_arg_types(str, int, normpath)
     def cmd_dset_attr(self, attr, val, path):
-        if path == '/':
-                if not self.dretrieve_dir(path, lambda: self.cmd_dset_attr(attr, val, path)):
+        self.dset_attr(attr, val, path)
+
+    def dset_attr(self, attr, val, path):
+        if path == '/':
+                if not self.dretrieve_dir(path, lambda: self.dset_attr(attr, val, path)):
                     return
         else:
             parent, filename = self.fs.get_parent(path)
-            if not self.dretrieve_dir(parent, lambda: self.cmd_dset_attr(attr, val, path)):
+            if not self.dretrieve_dir(parent, lambda: self.dset_attr(attr, val, path)):
                 return
 
         if self.fs.has_file(path):

Generated with KisssPM