summaryrefslogtreecommitdiffstats
path: root/core/views_survex.py
diff options
context:
space:
mode:
authorSam Wenham <sam@wenhams.co.uk>2019-02-24 13:03:34 +0000
committerSam Wenham <sam@wenhams.co.uk>2019-02-24 13:03:34 +0000
commit4ad5b684333bfb995160cd6bf00308d9f3839d4a (patch)
treef5683df0d04d8decad0685198e6e76980e376ef0 /core/views_survex.py
parent552730f0a38f474a181f2e1550589a4823667f3c (diff)
downloadtroggle-4ad5b684333bfb995160cd6bf00308d9f3839d4a.tar.gz
troggle-4ad5b684333bfb995160cd6bf00308d9f3839d4a.tar.bz2
troggle-4ad5b684333bfb995160cd6bf00308d9f3839d4a.zip
Make things more compatiable with newer python
Fix the expeditions list Improvements to make it compatiable with django 1.8 Bump the years to add 2018 Update the .hgignore file to ignore junk
Diffstat (limited to 'core/views_survex.py')
-rw-r--r--core/views_survex.py18
1 files changed, 11 insertions, 7 deletions
diff --git a/core/views_survex.py b/core/views_survex.py
index 28a4370..e252095 100644
--- a/core/views_survex.py
+++ b/core/views_survex.py
@@ -77,7 +77,7 @@ class SvxForm(forms.Form):
def DiffCode(self, rcode):
code = self.GetDiscCode()
difftext = difflib.unified_diff(code.splitlines(), rcode.splitlines())
- difflist = [ diffline.strip() for diffline in difftext if not re.match("\s*$", diffline) ]
+ difflist = [ diffline.strip() for diffline in difftext if not re.match(r"\s*$", diffline) ]
return difflist
def SaveCode(self, rcode):
@@ -98,7 +98,7 @@ class SvxForm(forms.Form):
return "SAVED"
def Process(self):
- print "....\n\n\n....Processing\n\n\n"
+ print("....\n\n\n....Processing\n\n\n")
cwd = os.getcwd()
os.chdir(os.path.split(settings.SURVEX_DATA + self.data['filename'])[0])
os.system(settings.CAVERN + " --log " + settings.SURVEX_DATA + self.data['filename'] + ".svx")
@@ -137,13 +137,13 @@ def svx(request, survex_file):
if not difflist:
message = "OUTPUT FROM PROCESSING"
logmessage = form.Process()
- print logmessage
+ print(logmessage)
else:
message = "SAVE FILE FIRST"
form.data['code'] = rcode
if "save" in rform.data:
if request.user.is_authenticated():
- #print "sssavvving"
+ #print("sssavvving")
message = form.SaveCode(rcode)
else:
message = "You do not have authority to save this file"
@@ -163,7 +163,7 @@ def svx(request, survex_file):
difflist.insert(0, message)
#print [ form.data['code'] ]
- svxincludes = re.findall('\*include\s+(\S+)(?i)', form.data['code'] or "")
+ svxincludes = re.findall(r'\*include\s+(\S+)(?i)', form.data['code'] or "")
vmap = {'settings': settings,
'has_3d': os.path.isfile(settings.SURVEX_DATA + survex_file + ".3d"),
@@ -256,7 +256,7 @@ def identifycavedircontents(gcavedir):
# direct local non-database browsing through the svx file repositories
# perhaps should use the database and have a reload button for it
def survexcaveslist(request):
- cavesdir = os.path.join(settings.SURVEX_DATA, "caves")
+ cavesdir = os.path.join(settings.SURVEX_DATA, "caves-1623")
#cavesdircontents = { }
onefilecaves = [ ]
@@ -264,9 +264,11 @@ def survexcaveslist(request):
subdircaves = [ ]
# first sort the file list
- fnumlist = [ (-int(re.match("\d*", f).group(0) or "0"), f) for f in os.listdir(cavesdir) ]
+ fnumlist = [ (-int(re.match(r"\d*", f).group(0) or "0"), f) for f in os.listdir(cavesdir) ]
fnumlist.sort()
+ print(fnumlist)
+
# go through the list and identify the contents of each cave directory
for num, cavedir in fnumlist:
if cavedir in ["144", "40"]:
@@ -297,6 +299,8 @@ def survexcaveslist(request):
multifilecaves.append((survdirobj[0], survdirobj[1:]))
# single file caves
else:
+ #print("survdirobj = ")
+ #print(survdirobj)
onefilecaves.append(survdirobj[0])
return render_to_response('svxfilecavelist.html', {'settings': settings, "onefilecaves":onefilecaves, "multifilecaves":multifilecaves, "subdircaves":subdircaves })