Commit 4e6433dc authored by Andreas Jung's avatar Andreas Jung

finally regex free - tried to survive

parent acd54c86
# -*- Mode: Python; tab-width: 4 -*- # -*- Mode: Python; tab-width: 4 -*-
# $Id: filesys.py,v 1.7 2001/04/25 19:07:30 andreas Exp $ # $Id: filesys.py,v 1.8 2001/04/27 18:25:42 andreas Exp $
# Author: Sam Rushing <rushing@nightmare.com> # Author: Sam Rushing <rushing@nightmare.com>
# #
# Generic filesystem interface. # Generic filesystem interface.
...@@ -69,9 +69,8 @@ class abstract_filesystem: ...@@ -69,9 +69,8 @@ class abstract_filesystem:
# what to do if wd is an invalid directory? # what to do if wd is an invalid directory?
import os import os,re
import stat import stat
import string import string
def safe_stat (path): def safe_stat (path):
...@@ -80,7 +79,6 @@ def safe_stat (path): ...@@ -80,7 +79,6 @@ def safe_stat (path):
except: except:
return None return None
import regsub
import glob import glob
class os_filesystem: class os_filesystem:
...@@ -171,7 +169,7 @@ class os_filesystem: ...@@ -171,7 +169,7 @@ class os_filesystem:
# utility methods # utility methods
def normalize (self, path): def normalize (self, path):
# watch for the ever-sneaky '/+' path element # watch for the ever-sneaky '/+' path element
path = regsub.gsub ('/+', '/', path) path = re.sub ('/+', '/', path)
p = self.path_module.normpath (path) p = self.path_module.normpath (path)
# remove 'dangling' cdup's. # remove 'dangling' cdup's.
if len(p) > 2 and p[:3] == '/..': if len(p) > 2 and p[:3] == '/..':
......
# -*- Mode: Python; tab-width: 4 -*- # -*- Mode: Python; tab-width: 4 -*-
# $Id: filesys.py,v 1.7 2001/04/25 19:07:30 andreas Exp $ # $Id: filesys.py,v 1.8 2001/04/27 18:25:42 andreas Exp $
# Author: Sam Rushing <rushing@nightmare.com> # Author: Sam Rushing <rushing@nightmare.com>
# #
# Generic filesystem interface. # Generic filesystem interface.
...@@ -69,9 +69,8 @@ class abstract_filesystem: ...@@ -69,9 +69,8 @@ class abstract_filesystem:
# what to do if wd is an invalid directory? # what to do if wd is an invalid directory?
import os import os,re
import stat import stat
import string import string
def safe_stat (path): def safe_stat (path):
...@@ -80,7 +79,6 @@ def safe_stat (path): ...@@ -80,7 +79,6 @@ def safe_stat (path):
except: except:
return None return None
import regsub
import glob import glob
class os_filesystem: class os_filesystem:
...@@ -171,7 +169,7 @@ class os_filesystem: ...@@ -171,7 +169,7 @@ class os_filesystem:
# utility methods # utility methods
def normalize (self, path): def normalize (self, path):
# watch for the ever-sneaky '/+' path element # watch for the ever-sneaky '/+' path element
path = regsub.gsub ('/+', '/', path) path = re.sub ('/+', '/', path)
p = self.path_module.normpath (path) p = self.path_module.normpath (path)
# remove 'dangling' cdup's. # remove 'dangling' cdup's.
if len(p) > 2 and p[:3] == '/..': if len(p) > 2 and p[:3] == '/..':
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment