mirror of
https://expo.survex.com/repositories/expoweb/.git/
synced 2024-12-03 15:12:22 +00:00
[svn r8182] Changes to file abstraction, that seemed to make it work by magic
This commit is contained in:
parent
d03d7c2d1c
commit
ffe7d51c40
@ -1,21 +1,28 @@
|
||||
import troggle.settings as settings
|
||||
import os
|
||||
import urllib
|
||||
|
||||
def urljoin(x, y): return x + "/" + y
|
||||
|
||||
def listdir(*path):
|
||||
try:
|
||||
strippedpath = [p for p in path if p]
|
||||
root = os.path.join(settings.FILES, *strippedpath )
|
||||
l = ""
|
||||
root = os.path.join(settings.FILES, *path)
|
||||
#l = root + "\n"
|
||||
#isdir = os.path.isdir(root)
|
||||
#l += str(isdir) + "\n"
|
||||
for p in os.listdir(root):
|
||||
if os.path.isdir(os.path.join(root, p)):
|
||||
l += p + "/\n"
|
||||
|
||||
elif os.path.isfile(os.path.join(root, p)):
|
||||
l += p + "\n"
|
||||
#Ignore non-files and non-directories
|
||||
return l
|
||||
except:
|
||||
return urllib.urlopen(settings.FILES + "listdir/" + reduce(urljoin, path))
|
||||
return urllib.urlopen(settings.FILES + "listdir/" + reduce(urljoin, strippedpath))
|
||||
|
||||
|
||||
def readFile(*path):
|
||||
try:
|
||||
|
Loading…
Reference in New Issue
Block a user