From: Fred L. D. <fd...@us...> - 2001-08-04 14:03:47
|
Update of /cvsroot/grail/grail/src In directory usw-pr-cvs1:/tmp/cvs-serv651 Modified Files: Authenticate.py Viewer.py Log Message: Migrate some of this code to "re", since "regex" has been deprecated. More needs to be done. Index: Authenticate.py =================================================================== RCS file: /cvsroot/grail/grail/src/Authenticate.py,v retrieving revision 2.8 retrieving revision 2.9 diff -C2 -r2.8 -r2.9 *** Authenticate.py 1999/03/05 21:42:07 2.8 --- Authenticate.py 2001/08/04 14:03:45 2.9 *************** *** 9,13 **** import urlparse import base64 - import regex class AuthenticationManager: --- 9,12 ---- *************** *** 56,60 **** pass ! basic_realm = regex.compile('realm="\(.*\)"') def basic_get_realm(self,challenge): --- 55,61 ---- pass ! import re ! basic_realm = re.compile('realm="(.*)"') ! del re def basic_get_realm(self,challenge): *************** *** 62,69 **** # entries seperated by commes, but for basic they don't # have any defined value. so don't bother with them. ! if self.basic_realm.search(challenge) < 0: ! return ! realm = self.basic_realm.group(1) ! return realm def basic_credentials(self, data): --- 63,69 ---- # entries seperated by commes, but for basic they don't # have any defined value. so don't bother with them. ! m = self.basic_realm.search(challenge) ! if m is not None: ! return m.group(1) def basic_credentials(self, data): Index: Viewer.py =================================================================== RCS file: /cvsroot/grail/grail/src/Viewer.py,v retrieving revision 1.143 retrieving revision 1.144 diff -C2 -r1.143 -r1.144 *** Viewer.py 1999/03/27 05:47:05 1.143 --- Viewer.py 2001/08/04 14:03:45 1.144 *************** *** 808,816 **** p = self.range_pattern except AttributeError: ! import regex ! p = regex.compile('#\([0-9]+\.[0-9]+\)-\([0-9]+\.[0-9]+\)') self.range_pattern = p ! if p.match(fragment) == len(fragment): ! return p.group(1, 2) else: return None --- 808,817 ---- p = self.range_pattern except AttributeError: ! import re ! p = re.compile('#([0-9]+\.[0-9]+)-([0-9]+\.[0-9]+)') self.range_pattern = p ! m = p.match(fragment) ! if m is not None and m.group() == fragment: ! return m.group(1, 2) else: return None |