This commit is contained in:
Rad 2019-02-25 21:02:30 +00:00
commit 71d1719850
3 changed files with 8 additions and 7 deletions

View File

@ -84,9 +84,9 @@ class SvxForm(forms.Form):
fname = settings.SURVEX_DATA + self.data['filename'] + ".svx" fname = settings.SURVEX_DATA + self.data['filename'] + ".svx"
if not os.path.isfile(fname): if not os.path.isfile(fname):
# only save if appears valid # only save if appears valid
if re.search("\[|\]", rcode): if re.search(r"\[|\]", rcode):
return "Error: clean up all []s from the text" return "Error: clean up all []s from the text"
mbeginend = re.search("(?s)\*begin\s+(\w+).*?\*end\s+(\w+)", rcode) mbeginend = re.search(r"(?s)\*begin\s+(\w+).*?\*end\s+(\w+)", rcode)
if not mbeginend: if not mbeginend:
return "Error: no begin/end block here" return "Error: no begin/end block here"
if mbeginend.group(1) != mbeginend.group(2): if mbeginend.group(1) != mbeginend.group(2):
@ -280,7 +280,7 @@ def survexcaveslist(request):
survdirobj = [ ] survdirobj = [ ]
for lsubsvx in subsvx: for lsubsvx in subsvx:
survdirobj.append(("caves/"+cavedir+"/"+lsubsvx, lsubsvx)) survdirobj.append(("caves-1623/"+cavedir+"/"+lsubsvx, lsubsvx))
# caves with subdirectories # caves with subdirectories
if subdirs: if subdirs:
@ -290,7 +290,7 @@ def survexcaveslist(request):
assert not dsubdirs assert not dsubdirs
lsurvdirobj = [ ] lsurvdirobj = [ ]
for lsubsvx in dsubsvx: for lsubsvx in dsubsvx:
lsurvdirobj.append(("caves/"+cavedir+"/"+subdir+"/"+lsubsvx, lsubsvx)) lsurvdirobj.append(("caves-1623/"+cavedir+"/"+subdir+"/"+lsubsvx, lsubsvx))
subsurvdirs.append((lsurvdirobj[0], lsurvdirobj[1:])) subsurvdirs.append((lsurvdirobj[0], lsurvdirobj[1:]))
subdircaves.append((cavedir, (survdirobj[0], survdirobj[1:]), subsurvdirs)) subdircaves.append((cavedir, (survdirobj[0], survdirobj[1:]), subsurvdirs))

View File

@ -116,7 +116,7 @@ def editflatpage(request, path):
if m: if m:
filefound = True filefound = True
preheader, headerargs, head, postheader, bodyargs, body, postbody = m.groups() preheader, headerargs, head, postheader, bodyargs, body, postbody = m.groups()
linksmatch = re.match('(.*)(<ul\s+id="links">.*)', body, re.DOTALL + re.IGNORECASE) linksmatch = re.match(r'(.*)(<ul\s+id="links">.*)', body, re.DOTALL + re.IGNORECASE)
if linksmatch: if linksmatch:
body, links = linksmatch.groups() body, links = linksmatch.groups()
if re.search(r"iso-8859-1", html): if re.search(r"iso-8859-1", html):

View File

@ -235,7 +235,7 @@ def LoadListScans():
def FindTunnelScan(tunnelfile, path): def FindTunnelScan(tunnelfile, path):
scansfolder, scansfile = None, None scansfolder, scansfile = None, None
mscansdir = re.search(r"(\d\d\d\d#\d+\w?|1995-96kh|92-94Surveybookkh|1991surveybook|smkhs)/(.*?(?:png|jpg))$", path) mscansdir = re.search(r"(\d\d\d\d#X?\d+\w?|1995-96kh|92-94Surveybookkh|1991surveybook|smkhs)/(.*?(?:png|jpg))$", path)
if mscansdir: if mscansdir:
scansfolderl = SurvexScansFolder.objects.filter(walletname=mscansdir.group(1)) scansfolderl = SurvexScansFolder.objects.filter(walletname=mscansdir.group(1))
if len(scansfolderl): if len(scansfolderl):
@ -244,6 +244,7 @@ def FindTunnelScan(tunnelfile, path):
if scansfolder: if scansfolder:
scansfilel = scansfolder.survexscansingle_set.filter(name=mscansdir.group(2)) scansfilel = scansfolder.survexscansingle_set.filter(name=mscansdir.group(2))
if len(scansfilel): if len(scansfilel):
print(scansfilel, len(scansfilel))
assert len(scansfilel) == 1 assert len(scansfilel) == 1
scansfile = scansfilel[0] scansfile = scansfilel[0]
@ -252,7 +253,7 @@ def FindTunnelScan(tunnelfile, path):
if scansfile: if scansfile:
tunnelfile.survexscans.add(scansfile) tunnelfile.survexscans.add(scansfile)
elif path and not re.search(r"\.(?:png|jpg)$(?i)", path): elif path and not re.search(r"\.(?:png|jpg|jpeg)$(?i)", path):
name = os.path.split(path)[1] name = os.path.split(path)[1]
print("ttt", tunnelfile.tunnelpath, path, name) print("ttt", tunnelfile.tunnelpath, path, name)
rtunnelfilel = TunnelFile.objects.filter(tunnelname=name) rtunnelfilel = TunnelFile.objects.filter(tunnelname=name)