[Zope-Checkins] CVS: Zope2 - HelpUtil.py:1.7.134.1

Andreas Jung andreas@dhcp165.digicool.com
Wed, 18 Apr 2001 15:09:43 -0400


Update of /cvs-repository/Zope2/lib/python/HelpSys
In directory yetix:/work/sandboxes/ajung-2_4-ts_regex-exterminiation-branch/lib/python/HelpSys

Modified Files:
      Tag: ajung-2_4-ts_regex-exterminiation-branch
	HelpUtil.py 
Log Message:
regex free



--- Updated File HelpUtil.py in package Zope2 --
--- HelpUtil.py	2000/05/26 15:40:22	1.7
+++ HelpUtil.py	2001/04/18 19:09:43	1.7.134.1
@@ -89,7 +89,7 @@
 
 import Globals, Acquisition
 import StructuredText.StructuredText
-import sys, os, string, regex
+import sys, os, string, re
 
 
 stx_class=StructuredText.StructuredText.HTML
@@ -282,10 +282,10 @@
 
 
 
+# needs to be tested !!! The conversion of reconvert.convert looks suspicious
+pre_match=re.compile('[A-Za-z0-9_]*\\([^\\)]*\\)[ -]*').match # AJ
+sig_match=re.compile('[A-Za-z0-9_]*\\([^\\)]*\\)').match # AJ
 
-pre_match=regex.compile('[A-Za-z0-9_]*([^)]*)[ -]*').match #TS
-sig_match=regex.compile('[A-Za-z0-9_]*([^)]*)').match #TS
-
 class methodobject(object):
 
     def get_class(self):
@@ -309,9 +309,9 @@
         if hasattr(func, 'func_code'):
             if hasattr(func.func_code, 'co_varnames'):
                 return doc
-        n=pre_match(doc)
-        if n > -1:
-            return doc[n:]
+        mo=pre_match(doc)
+        if mo is not None:
+            return doc[mo.end(0):]
         return doc
 
     def get_signaturex(self):
@@ -348,9 +348,9 @@
             doc=func.__doc__
             if not doc: doc=''
             doc=string.strip(doc)
-            n=sig_match(doc)
-            if n > -1:
-                return doc[:n]
+            mo=sig_match(doc)
+            if mo is not None:
+                return doc[:mo.end(0)]
         return '%s()' % name