summaryrefslogtreecommitdiffstats
path: root/expo
diff options
context:
space:
mode:
Diffstat (limited to 'expo')
-rw-r--r--expo/fileAbstraction.py10
-rw-r--r--expo/models.py1
2 files changed, 9 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:
diff --git a/expo/models.py b/expo/models.py
index ebaf9ab..6d38b4f 100644
--- a/expo/models.py
+++ b/expo/models.py
@@ -350,6 +350,7 @@ class Photo(models.Model):
scansFileStorage = FileSystemStorage(location=settings.SURVEYS, base_url=settings.SURVEYS_URL)
def get_scan_path(instance, filename):
year=instance.survey.expedition.year
+ print "WN: ", type(instance.survey.wallet_number), instance.survey.wallet_number
number="%02d" % instance.survey.wallet_number + str(instance.survey.wallet_letter) #using %02d string formatting because convention was 2009#01
return os.path.join('./',year,year+r'#'+number,instance.contents+str(instance.number_in_wallet)+r'.jpg')