[Zope-Checkins] CVS: Zope/lib/python/Products/ExternalMethod - ExternalMethod.py:1.48

Jim Fulton jim@zope.com
Tue, 23 Apr 2002 09:04:20 -0400


Update of /cvs-repository/Zope/lib/python/Products/ExternalMethod
In directory cvs.zope.org:/tmp/cvs-serv5397

Modified Files:
	ExternalMethod.py 
Log Message:
Added computed attribute for mapply to make up for removal of func_* attributes from normal state in previous fix

=== Zope/lib/python/Products/ExternalMethod/ExternalMethod.py 1.47 => 1.48 ===
 from Globals import DevelopmentMode
 from App.Management import Navigation
+from ComputedAttribute import ComputedAttribute
 
 manage_addExternalMethodForm=DTMLFile('dtml/methodAdd', globals())
 
@@ -78,8 +79,9 @@
     """
 
     meta_type = 'External Method'
-    _v_func_defaults = ()
-    _v_func_code = None
+
+    func_defaults = ComputedAttribute(lambda self: self._v_func_defaults)
+    func_code = ComputedAttribute(lambda self: self._v_func_code)
 
     ZopeTime=Acquisition.Acquired
     HelpSys=Acquisition.Acquired
@@ -126,12 +128,12 @@
         elif module[-4:]=='.pyc': module=module[:-4]
         self._module=module
         self._function=function
-        self.getFunction(1,1)
+        self.getFunction(1)
         if REQUEST:
             message="External Method Uploaded."
             return self.manage_main(self,REQUEST,manage_tabs_message=message)
 
-    def getFunction(self, check=0, reload=0):
+    def getFunction(self, reload=0):
 
         f=getObject(self._module, self._function, reload)
         if hasattr(f,'im_func'): ff=f.im_func
@@ -182,12 +184,13 @@
             ts=os.stat(self.filepath())[stat.ST_MTIME]
             if (not hasattr(self, '_v_last_read') or 
                 (ts != self._v_last_read)):
-                self._v_f=self.getFunction(1,1)
+                self._v_f=self.getFunction(1)
                 self._v_last_read=ts
 
         if hasattr(self, '_v_f'):
             f=self._v_f
-        else: f=self.getFunction()
+        else:
+            f=self.getFunction()
 
         __traceback_info__=args, kw, self._v_func_defaults