commit-gnue
[Top][All Lists]
Advanced

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

gnue/gnuef/src GFTrigger.py


From: Jason Cater
Subject: gnue/gnuef/src GFTrigger.py
Date: Sat, 06 Oct 2001 14:34:47 -0400

CVSROOT:        /home/cvs
Module name:    gnue
Changes by:     Jason Cater <address@hidden>    01/10/06 14:34:47

Modified files:
        gnuef/src      : GFTrigger.py 

Log message:
        possible fix to the exec() nested scope error introduced w/Python 2.1

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnuef/src/GFTrigger.py.diff?cvsroot=OldCVS&tr1=1.49&tr2=1.50&r1=text&r2=text

Patches:
Index: gnue/gnuef/src/GFTrigger.py
diff -u gnue/gnuef/src/GFTrigger.py:1.49 gnue/gnuef/src/GFTrigger.py:1.50
--- gnue/gnuef/src/GFTrigger.py:1.49    Thu Sep 13 18:39:22 2001
+++ gnue/gnuef/src/GFTrigger.py Sat Oct  6 14:34:47 2001
@@ -6,7 +6,7 @@
 # License as published by the Free Software Foundation; either 
 # version 2, or (at your option) any later version.
 #
-# GNU Enterprise is distributed in the hope that it will be 
+# GNU Enterprise is distributed in the hope that it will be
 # useful, but WITHOUT ANY WARRANTY; without even the implied 
 # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
 # PURPOSE. See the GNU General Public License for more details.
@@ -161,10 +161,10 @@
     #   during execution.
 
     # Get the indentation level of the first line of code so 
-    # we can indent our imports to the same level 
+    # we can indent our imports to the same level
     indentLevel = 0
     for line in string.split(string.replace(self._text,'\r',''),'\n'):
-      if len(string.strip(line)) and string.lstrip(line)[0] != '#': 
+      if len(string.strip(line)) and string.lstrip(line)[0] != '#':
         indentLevel = len(line) - len(string.lstrip(line))
         break
 
@@ -188,7 +188,8 @@
       triggerns['self'] = myself
       triggerns['runform'] = 
myself.findParentOfType('GFForm')._app.getManager().runFormFromTrigger
       try:
-        exec( code, triggerns )
+        locals = {}
+        exec code in triggerns, locals
       except TriggerError:
         raise
       except:
@@ -197,11 +198,11 @@
         print "%s in trigger code, value: %s" % (sys.exc_type, sys.exc_value)
 
     self.__call__ = thisTrigger
-      
+
   def dummyFunction(self, myself):
     print "Trigger not implemented"
 
-  def getDescription(self): 
+  def getDescription(self):
     if self.type == 'NAMED': 
       return self.name
     else: 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]