2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2024-11-21 14:51:51 +00:00

edit this page working

This commit is contained in:
Philip Sargent 2020-06-18 15:54:40 +01:00
parent 640e1e3b5e
commit bd6490631f
2 changed files with 18 additions and 27 deletions

View File

@ -89,10 +89,10 @@ def flatpage(request, path):
menumatch = re.match(rb'(.*)<ul id="links">', body, re.DOTALL + re.IGNORECASE)
if menumatch:
has_menu = True
#body, = menumatch.groups()
if re.search(rb"iso-8859-1", html):
body = str(body, "iso-8859-1")
body.strip
body, = menumatch.groups()
# if re.search(rb"iso-8859-1", html):
# body = str(body, "iso-8859-1")
# body.strip
return render(request, 'flatpage.html', {'editable': editable, 'path': path, 'title': title, 'body': body, 'homepage': (path == "index.htm"), 'has_menu': has_menu})
else:
return HttpResponse(o.read(), content_type=getmimetype(path))
@ -137,8 +137,8 @@ def editflatpage(request, path):
linksmatch = re.match(r'(.*)(<ul\s+id="links">.*)', body, re.DOTALL + re.IGNORECASE)
if linksmatch:
body, links = linksmatch.groups()
if re.search(r"iso-8859-1", html):
body = str(body, "iso-8859-1")
# if re.search(r"iso-8859-1", html):
# body = str(body, "iso-8859-1")
else:
return HttpResponse("Page could not be split into header and body")
except IOError:

25
urls.py
View File

@ -15,15 +15,12 @@ from flatpages import views as flatviews
admin.autodiscover()
# type url probably means it's used.
# HOW DOES THIS WORK:
# This is a "url dispatcher" - something needed by every web framework.
# url( <regular expression that matches the thing in the web browser>,
# <reference to python function in 'core' folder>,
# <name optional argument for URL reversing (doesn't do much)>)
# <reference to python function in 'core' folder>, <optional name>)
actualurlpatterns = [
url(r'^troggle$', views_other.frontpage, name="frontpage"),
url(r'^caves$', views_caves.caveindex, name="caveindex"),
url(r'^indxal.htm$', views_caves.caveindex, name="caveindex"),
@ -31,9 +28,10 @@ actualurlpatterns = [
url(r'^newqmnumber/?$', views_other.ajax_QM_number, ),
url(r'^lbo_suggestions/?$', logbook_entry_suggestions), #broken
#(r'^person/(?P<person_id>\d*)/?$', views_logbooks.person),
# url(r'^person/(?P<person_id>\d*)/?$', views_logbooks.person),
url(r'^person/(?P<first_name>[A-Z]*[a-z\-\'&;]*)[^a-zA-Z]*(?P<last_name>[a-z\-\']*[^a-zA-Z]*[A-Z]*[a-z\-&;]*)/?', views_logbooks.person, name="person"),
#url(r'^person/(\w+_\w+)$', views_logbooks.person, name="person"),
# url(r'^person/(\w+_\w+)$', views_logbooks.person, name="person"),
# url(r'^personform/(.*)$', personForm),
url(r'^expedition/(\d+)$', views_logbooks.expedition, name="expedition"),
url(r'^expeditions/?$', views_logbooks.ExpeditionListView.as_view(), name="expeditions"),
@ -71,7 +69,6 @@ actualurlpatterns = [
#url(r'^cavesearch', caveSearch),
url(r'^prospecting_guide/$', views_caves.prospecting),
url(r'^logbooksearch/(.*)/?$', views_logbooks.logbookSearch),
url(r'^statistics/?$', views_statistics.stats, name="stats"),
@ -88,9 +85,6 @@ actualurlpatterns = [
url(r'^accounts/', include('registration.backends.default.urls')),
url(r'^profiles/', include('profiles.urls')), # not used ? Delete this entire app then.
# (r'^personform/(.*)$', personForm),
url(r'^survexblock/(.+)$', views_caves.survexblock, name="survexblock"),
url(r'^survexfile/(?P<survex_file>.*?)\.svx$', views_survex.svx, name="svx"),
url(r'^survexfile/(?P<survex_file>.*?)\.3d$', views_survex.threed, name="threed"),
@ -111,11 +105,10 @@ actualurlpatterns = [
view_surveys.surveyscansingle, name="surveyscansingle"),
url(r'^tunneldata/$', view_surveys.tunneldata, name="tunneldata"),
# url(r'^tunneldatainfo/(?P<path>.+?\.xml)$', view_surveys.tunnelfileinfo, name="tunnelfileinfo"),
url(r'^tunneldataraw/(?P<path>.+?\.xml)$', view_surveys.tunnelfile, name="tunnelfile"),
url(r'^tunneldataraw/(?P<path>.+?\.xml)/upload$',view_surveys.tunnelfileupload, name="tunnelfileupload"),
# url(r'^tunneldatainfo/(?P<path>.+?\.xml)$', view_surveys.tunnelfileinfo, name="tunnelfileinfo"),
url(r'^prospecting/(?P<name>[^.]+).png$', prospecting_image, name="prospecting_image"),
url(r'^expofiles/(?P<path>.*)$', staticviews.serve,
@ -124,19 +117,17 @@ actualurlpatterns = [
{'document_root': settings.STATIC_ROOT, 'show_indexes': True}),
url(r'^site_media/(?P<path>.*)$', staticviews.serve,
{'document_root': settings.MEDIA_ROOT, 'show_indexes': True}),
# url(r'^troggle/media-admin/(?P<path>.*)$', staticviews.serve,
# {'document_root': settings.MEDIA_ADMIN_DIR, 'show_indexes':True}),
#url(r'^tinymce_media/(?P<path>.*)$', staticviews.serve,
# {'document_root': settings.TINY_MCE_MEDIA_ROOT, 'show_indexes': True}),
#url(r'^photos/(?P<path>.*)$', staticviews.serve,
# {'document_root': settings.PHOTOS_ROOT, 'show_indexes':True}),
# url(r'^gallery/(?P<path>.*)$', staticviews.serve,
# {'document_root': settings.PHOTOS_ROOT, 'show_indexes':True}),
# don't know why this needs troggle/ in here. nice to get it out
url(r'^troggle/media-admin/(?P<path>.*)$', staticviews.serve,
{'document_root': settings.MEDIA_ADMIN_DIR, 'show_indexes':True}),
url(r'^(.*)_edit$', flatviews.editflatpage, name="editflatpage"),
url(r'^(.*)$', flatviews.flatpage, name="flatpage"),
]
#Allow prefix to all urls