mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2024-11-22 07:11:52 +00:00
fix incorrect folder when showing index.html
This commit is contained in:
parent
9db1a8490c
commit
6d6bec35f2
@ -46,8 +46,6 @@ default_head = '''<head>
|
|||||||
<li><form name=P method=get action="/search" target="_top">
|
<li><form name=P method=get action="/search" target="_top">
|
||||||
<input id="omega-autofocus" type=search name=P value="testing" size=8 autofocus>
|
<input id="omega-autofocus" type=search name=P value="testing" size=8 autofocus>
|
||||||
<input type=submit value="Search"></li>
|
<input type=submit value="Search"></li>
|
||||||
<li><a href="/years/1983/index.html_edit" class="editlink"><strong>Edit this page</strong></a></li>
|
|
||||||
|
|
||||||
</ul>'''
|
</ul>'''
|
||||||
|
|
||||||
def expofiles_redirect(request, path):
|
def expofiles_redirect(request, path):
|
||||||
@ -96,7 +94,7 @@ def expowebpage(request, expowebpath, path):
|
|||||||
if m:
|
if m:
|
||||||
preheader, headerattrs, head, postheader, bodyattrs, body, postbody = m.groups()
|
preheader, headerattrs, head, postheader, bodyattrs, body, postbody = m.groups()
|
||||||
else:
|
else:
|
||||||
return HttpResponse(default_head + html.decode() + '<h3>HTML Parsing failure:<br>Page could not be parsed into header and body:<br>failure detected in expowebpage in views.expo.py</h3> Please edit this <var>:expoweb:</var> page to be in the expected full HTML format by clicking on \'Edit this Page\' in the left hand menu.</body' )
|
return HttpResponse(default_head + html.decode() + '<h3>HTML Parsing failure:<br>Page could not be parsed into header and body:<br>failure detected in expowebpage in views.expo.py</h3> Please edit this <var>:expoweb:</var> page to be in the expected full HTML format </body' )
|
||||||
m = re.search(rb"<title>(.*)</title>", head, re.DOTALL + re.IGNORECASE)
|
m = re.search(rb"<title>(.*)</title>", head, re.DOTALL + re.IGNORECASE)
|
||||||
if m:
|
if m:
|
||||||
title, = m.groups()
|
title, = m.groups()
|
||||||
@ -158,13 +156,10 @@ def expopage(request, path):
|
|||||||
return expowebpage(request, expowebpath, path)
|
return expowebpage(request, expowebpath, path)
|
||||||
|
|
||||||
if Path(expowebpath / path ).is_dir():
|
if Path(expowebpath / path ).is_dir():
|
||||||
for p in ["index.html", "index.htm", "default.html"]:
|
for p in ["index.html", "index.htm"]:
|
||||||
try:
|
if (expowebpath / path / p).is_file():
|
||||||
o = open(os.path.normpath(expowebpath / path / p), "rb")
|
# This needs to reset the path to the new subdirectory
|
||||||
except IOError:
|
return HttpResponseRedirect('/'+str(Path(path) / p))
|
||||||
pass
|
|
||||||
else: # no exception, so file was found
|
|
||||||
return expowebpage(request, expowebpath, Path(path) / p)
|
|
||||||
return render(request, 'pagenotfound.html', {'path': Path(path) / "index.html"})
|
return render(request, 'pagenotfound.html', {'path': Path(path) / "index.html"})
|
||||||
|
|
||||||
if path.endswith("/"):
|
if path.endswith("/"):
|
||||||
@ -240,7 +235,7 @@ def editexpopage(request, path):
|
|||||||
# body = str(body, "iso-8859-1")
|
# body = str(body, "iso-8859-1")
|
||||||
else:
|
else:
|
||||||
#return HttpResponse("Page could not be split into header and body")
|
#return HttpResponse("Page could not be split into header and body")
|
||||||
return HttpResponse(default_head + html.decode() + '<h3>HTML Parsing failure:<br>Page could not be parsed into header and body:<br>failure detected in expowebpage in views.expo.py</h3> Please edit this <var>:expoweb:</var> page to be in the expected full HTML format by clicking on \'Edit this Page\' in the left hand menu.</body' )
|
return HttpResponse(default_head + html + '<h3>HTML Parsing failure:<br>Page could not be parsed into header and body:<br>failure detected in expowebpage in views.expo.py</h3> Please edit this <var>:expoweb:</var> page to be in the expected full HTML format .</body' )
|
||||||
except IOError:
|
except IOError:
|
||||||
print("### File not found ### ", filepath)
|
print("### File not found ### ", filepath)
|
||||||
filefound = False
|
filefound = False
|
||||||
|
Loading…
Reference in New Issue
Block a user