[Zope3-checkins] SVN: Zope3/trunk/src/zope/tal/talinterpreter.py - avoid excess string splitting

Fred L. Drake, Jr. fdrake at gmail.com
Tue Mar 14 10:23:46 EST 2006


Log message for revision 66014:
  - avoid excess string splitting
  - add a note about how a TODO could be handled
  

Changed:
  U   Zope3/trunk/src/zope/tal/talinterpreter.py

-=-
Modified: Zope3/trunk/src/zope/tal/talinterpreter.py
===================================================================
--- Zope3/trunk/src/zope/tal/talinterpreter.py	2006-03-14 14:12:00 UTC (rev 66013)
+++ Zope3/trunk/src/zope/tal/talinterpreter.py	2006-03-14 15:23:44 UTC (rev 66014)
@@ -899,7 +899,7 @@
 
         # We want 'macroname' name to be always available as a variable
         outer = self.engine.getValue('macroname')
-        self.engine.setLocal('macroname', macroName.split('/')[-1])
+        self.engine.setLocal('macroname', macroName.rsplit('/', 1)[-1])
 
         prev_source = self.sourceFile
         wasInUse = self.inUseDirective
@@ -985,6 +985,9 @@
         try:
             self.interpret(block)
         # TODO: this should not catch ZODB.POSException.ConflictError.
+        # The ITALExpressionEngine interface should provide a way of
+        # getting the set of exception types that should not be
+        # handled.
         except:
             exc = sys.exc_info()[1]
             self.restoreState(state)



More information about the Zope3-Checkins mailing list