[Erp5-report] r10709 - /erp5/trunk/bt5/erp5_dms/ExtensionTemplateItem/cutFound.py

nobody at svn.erp5.org nobody at svn.erp5.org
Fri Oct 13 21:42:05 CEST 2006


Author: bartek
Date: Fri Oct 13 21:42:02 2006
New Revision: 10709

URL: http://svn.erp5.org?rev=10709&view=rev
Log:
fix - if the last found word was close to the end, the last part was not returned

Modified:
    erp5/trunk/bt5/erp5_dms/ExtensionTemplateItem/cutFound.py

Modified: erp5/trunk/bt5/erp5_dms/ExtensionTemplateItem/cutFound.py
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_dms/ExtensionTemplateItem/cutFound.py?rev=10709&r1=10708&r2=10709&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_dms/ExtensionTemplateItem/cutFound.py (original)
+++ erp5/trunk/bt5/erp5_dms/ExtensionTemplateItem/cutFound.py Fri Oct 13 21:42:02 2006
@@ -45,7 +45,8 @@
   sw=sw.translate(tr).strip().split()
   test=lambda w:w.translate(tr).strip().lower() in sw
   i=0
-  for aw in text:
+  length=len(text)
+  for counter,aw in enumerate(text):
     if i==maxlines:
       raise StopIteration
     if test(aw):
@@ -57,6 +58,10 @@
         i+=1
         yield par
         par=Part(tags,trail)
+      if counter==length-1:
+        if par.has:
+          par.chain.reverse()
+          yield par # return the last marked part
 
 
 def cutFound(context,txt,sw,tags,trail,maxlines):




More information about the Erp5-report mailing list