[Zope3-checkins] CVS: Zope3/src/zope/tal - talinterpreter.py:1.31

Stephan Richter srichter at cosmos.phy.tufts.edu
Tue Mar 23 14:18:46 EST 2004


Update of /cvs-repository/Zope3/src/zope/tal
In directory cvs.zope.org:/tmp/cvs-serv17789/src/zope/tal

Modified Files:
	talinterpreter.py 
Log Message:


Macro name is stored in reserved varaibale name 'macroname'.




=== Zope3/src/zope/tal/talinterpreter.py 1.30 => 1.31 ===
--- Zope3/src/zope/tal/talinterpreter.py:1.30	Tue Feb 24 08:58:18 2004
+++ Zope3/src/zope/tal/talinterpreter.py	Tue Mar 23 14:18:10 2004
@@ -665,12 +665,19 @@
                 raise METALError("macro %s has incompatible mode %s" %
                                  (`macroName`, `mode`), self.position)
         self.pushMacro(macroName, compiledSlots)
+        
+        # We want 'macroname' name to be always available as a variable 
+        outer = self.engine.getValue('macroname')
+        self.engine.setLocal('macroname', macroName.split('/')[-1])
+
         prev_source = self.sourceFile
         self.interpret(macro)
         if self.sourceFile != prev_source:
             self.engine.setSourceFile(prev_source)
             self.sourceFile = prev_source
         self.popMacro()
+        # Push the outer macroname again.
+        self.engine.setLocal('macroname', outer)
     bytecode_handlers["useMacro"] = do_useMacro
 
     def do_fillSlot(self, (slotName, block)):




More information about the Zope3-Checkins mailing list