commit-gnue
[Top][All Lists]
Advanced

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

[gnue] r8432 - trunk/gnue-common/src/logic


From: reinhard
Subject: [gnue] r8432 - trunk/gnue-common/src/logic
Date: Wed, 19 Apr 2006 07:28:41 -0500 (CDT)

Author: reinhard
Date: 2006-04-19 07:28:41 -0500 (Wed, 19 Apr 2006)
New Revision: 8432

Modified:
   trunk/gnue-common/src/logic/GTrigger.py
Log:
Better repr() for triggers. Already use it for the execution context.


Modified: trunk/gnue-common/src/logic/GTrigger.py
===================================================================
--- trunk/gnue-common/src/logic/GTrigger.py     2006-04-19 12:10:43 UTC (rev 
8431)
+++ trunk/gnue-common/src/logic/GTrigger.py     2006-04-19 12:28:41 UTC (rev 
8432)
@@ -90,6 +90,11 @@
       self._buildObject()
 
 
+  def __repr__(self):
+
+    return repr(self.getParent()) + '.' + self.getDescription()
+
+
   #
   # Must be at least a phase 2 init
   #
@@ -129,44 +134,15 @@
 
   def __set_function(self, code):
 
-    # build a name for the execution context which will be helpful if displayed
-    # in error messages
-    if self.type == 'NAMED':
-      execution_context_name = "Named trigger %s" % self.name
-    else:
-      path = ""
-      p = self
-      delim = ""
-      while p:
-        if hasattr(p, 'name'):
-          if p.name:
-            path = p.name + delim + path
-            delim = "."
-        if hasattr(p, 'type'):
-          if p.type:
-            path = p.type + delim + path
-            delim = "."
-        if p._triggerGlobal == 1:
-          p = None
-        else:
-          p = p.getParent()
-      execution_context_name = path
-
-    # Build a name for the function
-    if self.name:
-      function_name = self.name
-    else:
-      function_name = self.type.upper()
-
     execution_context = language.create_execution_context(
             language = self.language,
-            name = execution_context_name,
+            name = repr(self),
             local_namespace = {},
             global_namespace = self.__root._triggerns,
             builtin_namespace = {})
 
     self.__call__ = execution_context.build_function(
-            name = function_name,
+            name = self.getDescription(),
             parameters = ['self'],
             code = code)
 
@@ -280,7 +256,7 @@
         if self.__triggers.has_key(key):
             for function in self.__triggers[key]:
                 try:
-                    return function(self = self.get_namespace_object)
+                    return function(self = self.get_namespace_object())
                 except language.AbortRequest:
                     if not ignoreAbort:
                         raise





reply via email to

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