mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2025-12-15 23:27:07 +00:00
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
This commit is contained in:
@@ -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 })
|
||||
|
||||
Reference in New Issue
Block a user