[Zope-Checkins] CVS: Zope2 - client.py:1.15.4.1

Andreas Jung andreas@dhcp165.digicool.com
Wed, 18 Apr 2001 14:59:49 -0400


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

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



--- Updated File client.py in package Zope2 --
--- client.py	2001/04/04 18:25:20	1.15
+++ client.py	2001/04/18 18:59:49	1.15.4.1
@@ -2,7 +2,7 @@
 
 __version__='$Revision$'[11:-2]
 
-import sys, os, string, regex, time, types
+import sys, os, string, re, time, types
 import socket, httplib, mimetools
 from types import FileType
 from mimetypes import guess_type
@@ -57,8 +57,10 @@
         self.username=username
         self.password=password
         self.url=url
-        if urlregex.match(url) >= 0:
-            host,port,uri=urlregex.group(1,2,3)
+
+        mo = urlregex.match(url)
+        if mo is not None:
+            host,port,uri=mo.group(1,2,3)
             self.host=host
             self.port=port and string.atoi(port[1:]) or 80
             self.uri=uri or '/'
@@ -156,11 +158,11 @@
             return self.__snd_request('POST', self.uri, headers, body)
 
     def put(self, file='', content_type='', content_enc='',
-            isbin=regex.compile('[\0-\6\177-\277]').search,
+            isbin=re.compile('[\0-\6\177-\277]').search,
             **kw):
         headers=self.__get_headers(kw)
         filetype=type(file)
-        if filetype is type('') and (isbin(file) < 0) and \
+        if filetype is type('') and (isbin(file) is None) and \
            os.path.exists(file):
             ob=open(file, 'rb')
             body=ob.read()
@@ -423,7 +425,7 @@
 ##############################################################################
 # Implementation details below here
 
-urlregex=regex.compile('http://\([^:/]+\)\(:[0-9]+\)?\(/.+\)?', regex.casefold)
+urlregex=re.compile('http://([^:/]+)(:[0-9]+)?(/.+)?', re.I)
 
 def marshal_string(name, val):
     return '%s=%s' % (name, quote(str(val)))