[PATCH] Remove safe_apply()



Could someone tell me what this is fixing ?
Why not apply the attached patch

-- 
Vincent Legoll
Index: misc.py
===================================================================
--- misc.py	(revision 1311)
+++ misc.py	(working copy)
@@ -231,21 +231,6 @@
     pipe.tochild.close()
     return pipe.wait()
 
-def safe_apply(obj, method, args):
-    """Call 'obj.method(args)' if 'obj' has an attribute named 'method'.
-
-    If 'obj' has no method 'method' this is a no-op.
-    """
-    try:
-        m = getattr(obj, method)
-    except AttributeError:
-        pass
-    else:
-        # allow single arguments to be passed as is.
-        if type(args) != type(()):
-            args = (args,)
-        apply(m, args)
-
 def clamp(val, lower, upper):
     """Clamp 'val' to the inclusive range [lower,upper].
     """
Index: meldapp.py
===================================================================
--- meldapp.py	(revision 1307)
+++ meldapp.py	(working copy)
@@ -792,10 +792,10 @@
             #self.append_filediff( ("ntest/file9a", "ntest/file9b") )
 
     def on_menu_edit_down_activate(self, *args):
-        misc.safe_apply( self.current_doc(), "next_diff", gtk.gdk.SCROLL_DOWN )
+        self.current_doc().next_diff(gtk.gdk.SCROLL_DOWN)
 
     def on_menu_edit_up_activate(self, *args):
-        misc.safe_apply( self.current_doc(), "next_diff", gtk.gdk.SCROLL_UP )
+        self.current_doc().next_diff(gtk.gdk.SCROLL_UP)
 
     def on_toolbar_stop_clicked(self, *args):
         self.current_doc().stop()


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]