diff options
author | substantialnoninfringinguser <substantialnoninfringinguser@gmail.com> | 2009-05-13 05:38:37 +0100 |
---|---|---|
committer | substantialnoninfringinguser <substantialnoninfringinguser@gmail.com> | 2009-05-13 05:38:37 +0100 |
commit | 99ab1e22e9dfd8ca058cb2256ee01b6492659438 (patch) | |
tree | e6146a5b57bdfca9d89049dd9a2bc43e2d005e5d /expo/fileAbstraction.py | |
parent | 0f5109cb0988d76c5b7d3037acca0ad8ac07f0dd (diff) | |
download | troggle-99ab1e22e9dfd8ca058cb2256ee01b6492659438.tar.gz troggle-99ab1e22e9dfd8ca058cb2256ee01b6492659438.tar.bz2 troggle-99ab1e22e9dfd8ca058cb2256ee01b6492659438.zip |
[svn] MOre work on abstracting the file locations on scanned survey notes
Copied from http://cucc@cucc.survex.com/svn/trunk/expoweb/troggle/, rev. 8190 by julian @ 1/18/2009 9:04 PM
Diffstat (limited to 'expo/fileAbstraction.py')
-rw-r--r-- | expo/fileAbstraction.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/expo/fileAbstraction.py b/expo/fileAbstraction.py index 4431480..299a488 100644 --- a/expo/fileAbstraction.py +++ b/expo/fileAbstraction.py @@ -25,9 +25,15 @@ def listdir(*path): c = reduce(urljoin, strippedpath) else: c = "" - print strippedpath, c - return urllib.urlopen(settings.FILES + "listdir/" + c) + c = c.replace("#", "%23") + print "FILE: ", settings.FILES + "listdir/" + c + return urllib.urlopen(settings.FILES + "listdir/" + c).read() + +def dirsAsList(*path): + return [d for d in listdir(*path).split("\n") if len(d) > 0 and d[-1] == "/"] +def filesAsList(*path): + return [d for d in listdir(*path).split("\n") if len(d) > 0 and d[-1] != "/"] def readFile(*path): try: |