diff --git a/core/views_caves.py b/core/views_caves.py index 6dab34a..5ee0d82 100644 --- a/core/views_caves.py +++ b/core/views_caves.py @@ -29,7 +29,7 @@ def getCave(cave_id): return cave def pad5(x): - return "0" * (5 -len(x.group(0))) + x.group(0) + return "0" * (5 -len(x.group(0))) + x.group(0) def padnumber(x): return re.sub("\d+", pad5, x) def numericalcmp(x, y): @@ -46,7 +46,7 @@ def caveCmp(x, y): else: if y.kataster_number: return 1 - else: + else: return numericalcmp(x.unofficial_number, y.unofficial_number) def caveindex(request): @@ -62,7 +62,6 @@ def caveindex(request): def millenialcaves(request): #RW messing around area return HttpResponse("Test text", content_type="text/plain") - def cave3d(request, cave_id=''): @@ -154,14 +153,14 @@ def edit_cave(request, slug=None): ceinst.cave = cave ceinst.save() cave.writeDataFile() - return HttpResponseRedirect("/" + cave.url) + return HttpResponseRedirect("/" + cave.url) else: form = CaveForm(instance=cave) ceFormSet = CaveAndEntranceFormSet(queryset=cave.caveandentrance_set.all()) versionControlForm = VersionControlCommentForm() - - return render(request, - 'editcave2.html', + + return render(request, + 'editcave2.html', {'form': form, 'caveAndEntranceFormSet': ceFormSet, 'versionControlForm': versionControlForm @@ -169,7 +168,7 @@ def edit_cave(request, slug=None): @login_required_if_public def editEntrance(request, caveslug, slug=None): - cave = Cave.objects.get(caveslug__slug = caveslug) + cave = Cave.objects.get(caveslug__slug = caveslug) if slug is not None: entrance = Entrance.objects.get(entranceslug__slug = slug) else: @@ -196,7 +195,7 @@ def editEntrance(request, caveslug, slug=None): el.entrance = entrance el.save() entrance.writeDataFile() - return HttpResponseRedirect("/" + cave.url) + return HttpResponseRedirect("/" + cave.url) else: form = EntranceForm(instance = entrance) versionControlForm = VersionControlCommentForm() @@ -204,8 +203,8 @@ def editEntrance(request, caveslug, slug=None): entletter = EntranceLetterForm(request.POST) else: entletter = None - return render(request, - 'editentrance.html', + return render(request, + 'editentrance.html', {'form': form, 'versionControlForm': versionControlForm, 'entletter': entletter @@ -221,9 +220,8 @@ def qm(request,qm_id): if grade: url += r'&grade=' + grade return HttpResponseRedirect(url) - - + def ent(request, cave_id, ent_letter): cave = Cave.objects.filter(kataster_number = cave_id)[0] cave_and_ent = CaveAndEntrance.objects.filter(cave = cave).filter(entrance_letter = ent_letter)[0] @@ -255,7 +253,7 @@ def survey(request,year,wallet_number): surveys=Survey.objects.all() expeditions=Expedition.objects.order_by("-year") current_expedition=Expedition.objects.filter(year=year)[0] - + if wallet_number!='': current_survey=Survey.objects.filter(expedition=current_expedition,wallet_number=wallet_number)[0] notes=current_survey.scannedimage_set.filter(contents='notes') @@ -313,7 +311,7 @@ def prospecting(request): caves.sort(caveCmp) areas.append((name, a, caves)) return render(request, 'prospecting.html', {"areas": areas}) - + # Parameters for big map and zoomed subarea maps: # big map first (zoom factor ignored) @@ -343,7 +341,7 @@ for n in maps.keys(): for j in range(2): maps["%s%i%i" % (n, i, j)] = [L + i * W, T - j * H, L + (i + 1) * W, T - (j + 1) * H, S, name] # Keys in the order in which we want the maps output -mapcodes = ["all", "grieß","40", "76", "204", "tc"] +mapcodes = ["all", "grieß","40", "76", "204", "tc"] # Field codes L = 0 T = 1 @@ -400,7 +398,7 @@ def mungecoord(x, y, mapcode, img): COL_TYPES = {True: "red", False: "#dddddd", "Reference": "#dddddd"} - + def plot(surveypoint, number, point_type, label, mapcode, draw, img): try: ss = SurvexStation.objects.lookup(surveypoint) @@ -509,8 +507,8 @@ def prospecting_image(request, name): del draw img.save(response, "PNG") return response - -STATIONS = {} + +STATIONS = {} poslineregex = re.compile("^\(\s*([+-]?\d*\.\d*),\s*([+-]?\d*\.\d*),\s*([+-]?\d*\.\d*)\s*\)\s*([^\s]+)$") def LoadPos(): call([settings.CAVERN, "--output=%s/all.3d" % settings.SURVEX_DATA, "%s/all.svx" % settings.SURVEX_DATA]) @@ -518,7 +516,7 @@ def LoadPos(): posfile = open("%sall.pos" % settings.SURVEX_DATA) posfile.readline()#Drop header for line in posfile.readlines(): - r = poslineregex.match(line) + r = poslineregex.match(line) if r: x, y, z, name = r.groups() STATIONS[name] = (x, y, z) diff --git a/docker/Dockerfile b/docker/Dockerfile index 2b4882a..8dedd8d 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -10,9 +10,9 @@ RUN apt-get -y update && apt-get install -y mercurial \ # Set the locale RUN locale-gen en_GB.UTF-8 -ENV LANG en_GB.UTF-8 -ENV LANGUAGE en_GB:en -ENV LC_ALL en_GB.UTF-8 +ENV LANG en_GB.UTF-8 +ENV LANGUAGE en_GB:en +ENV LC_ALL en_GB.UTF-8 WORKDIR /opt/expo/troggle COPY requirements.txt . diff --git a/flatpages/views.py b/flatpages/views.py index 6ef2404..0ba4d4e 100644 --- a/flatpages/views.py +++ b/flatpages/views.py @@ -33,7 +33,6 @@ def flatpage(request, path): except EntranceRedirect.DoesNotExist: pass - if path.startswith("noinfo") and settings.PUBLIC_SITE and not request.user.is_authenticated(): print("flat path noinfo", path) return HttpResponseRedirect(reverse("auth_login") + '?next=%s' % request.path) @@ -48,7 +47,7 @@ def flatpage(request, path): path = path + "index.htm" except IOError: return render(request, 'pagenotfound.html', {'path': path}) - else: + else: try: filetobeopened = os.path.normpath(settings.EXPOWEB + path) o = open(filetobeopened, "rb") @@ -56,7 +55,7 @@ def flatpage(request, path): return render(request, 'pagenotfound.html', {'path': path}) if path.endswith(".htm") or path.endswith(".html"): html = o.read() - + m = re.search(r"(.*)<\s*head([^>]*)>(.*)<\s*/head\s*>(.*)<\s*body([^>]*)>(.*)<\s*/body\s*>(.*)", html, re.DOTALL + re.IGNORECASE) if m: preheader, headerattrs, head, postheader, bodyattrs, body, postbody = m.groups() @@ -125,7 +124,7 @@ def editflatpage(request, path): return HttpResponse("Page could not be split into header and body") except IOError: filefound = False - + if request.method == 'POST': # If the form has been submitted... flatpageForm = FlatPageForm(request.POST) # A form bound to the POST data @@ -142,7 +141,7 @@ def editflatpage(request, path): headerargs = "" postheader = "" bodyargs = "" - postbody = "" + postbody = "" body = flatpageForm.cleaned_data["html"] body = body.replace("\r", "") result = u"%s%s%s\n%s%s" % (preheader, headerargs, head, postheader, bodyargs, body, postbody) @@ -153,7 +152,7 @@ def editflatpage(request, path): else: if filefound: m = re.search(r"(.*)", head, re.DOTALL + re.IGNORECASE) - if m: + if m: title, = m.groups() else: title = "" diff --git a/parsers/logbooks.py b/parsers/logbooks.py index 012d771..2f92c8e 100644 --- a/parsers/logbooks.py +++ b/parsers/logbooks.py @@ -166,7 +166,7 @@ def Parseloghtmltxt(year, expedition, txt): for trippara in tripparas: #print(" - HR detected - maybe a trip?") logbook_entry_count += 1 - + s = re.match(r'''(?x)(?:\s*.*?\s*

)? # second date \s*(?:\s*)? \s*(.*?)(?:

)? diff --git a/templates/cave.html b/templates/cave.html index 1ba898e..7d21ca7 100644 --- a/templates/cave.html +++ b/templates/cave.html @@ -17,7 +17,7 @@ div.cv-panel { } div.cv-compass, div.cv-ahi { - position: absolute; + position: absolute; bottom: 95px; right: 5px; margin: 0; @@ -31,7 +31,7 @@ div.cv-compass, div.cv-ahi { background-color: black; color: white; } - + div.cv-ahi { right: 95px; } @@ -152,7 +152,7 @@ div.linear-scale-caption { position: absolute; top: 64px; left: 0px; - height: auto; + height: auto; margin-top:0; bottom: 44px; background-color: #222222; @@ -220,7 +220,7 @@ div.linear-scale-caption { } #frame .tab { position: absolute; - right: 0px;lass="cavedisplay" + right: 0px; width: 40px; height: 40px; box-sizing: border-box; @@ -523,7 +523,7 @@ div#scene { {% endif %} {{ ent.entrance.other_location.y|safe }}, {{ ent.entrance.other_location.x|safe }}, {{ ent.entrance.other_location.z|safe }}m {% endif %} - + {% endfor %}