From cdef395f89e81c2231538d76f1204cbe322fa289 Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Thu, 27 Feb 2020 00:58:09 +0000 Subject: [PATCH] New troggle report on defined directory paths --- core/views_logbooks.py | 54 ++++++++++++++++++++++++++++++++++ pathreport.py | 60 ++++++++++++++++++++++++++++++++++++++ templates/pathsreport.html | 45 ++++++++++++++++++++++++++++ urls.py | 1 + 4 files changed, 160 insertions(+) create mode 100644 pathreport.py create mode 100644 templates/pathsreport.html diff --git a/core/views_logbooks.py b/core/views_logbooks.py index 1bc709c..8ec0f18 100644 --- a/core/views_logbooks.py +++ b/core/views_logbooks.py @@ -164,7 +164,61 @@ def personForm(request,pk): form=PersonForm(instance=person) return render(request,'personform.html', {'form':form,}) +from settings import * +def pathsreport(request): + pathsdict={ + "ADMIN_MEDIA_PREFIX" : ADMIN_MEDIA_PREFIX, + "ADMIN_MEDIA_PREFIX" : ADMIN_MEDIA_PREFIX, + "CAVEDESCRIPTIONSX" : CAVEDESCRIPTIONS, + "DIR_ROOT" : DIR_ROOT, + "EMAIL_HOST" : EMAIL_HOST, + "EMAIL_HOST_USER" : EMAIL_HOST_USER, + "ENTRANCEDESCRIPTIONS" : ENTRANCEDESCRIPTIONS, + "EXPOUSER_EMAIL" : EXPOUSER_EMAIL, + "EXPOUSERPASS" :"", + "EXPOUSER" : EXPOUSER, + "EXPOWEB" : EXPOWEB, + "EXPOWEB_URL" : EXPOWEB_URL, + "FILES" : FILES, + "JSLIB_URL" : JSLIB_URL, + "LOGFILE" : LOGFILE, + "LOGIN_REDIRECT_URL" : LOGIN_REDIRECT_URL, + "MEDIA_ADMIN_DIR" : MEDIA_ADMIN_DIR, + "MEDIA_ROOT" : MEDIA_ROOT, + "MEDIA_URL" : MEDIA_URL, + "PHOTOS_ROOT" : PHOTOS_ROOT, + "PHOTOS_URL" : PHOTOS_URL, + "PYTHON_PATH" : PYTHON_PATH, + "REPOS_ROOT_PATH" : REPOS_ROOT_PATH, + "ROOT_URLCONF" : ROOT_URLCONF, + "STATIC_ROOT" : STATIC_ROOT, + "STATIC_URL" : STATIC_URL, + "SURVEX_DATA" : SURVEX_DATA, + "SURVEY_SCANS" : SURVEY_SCANS, + "SURVEYS" : SURVEYS, + "SURVEYS_URL" : SURVEYS_URL, + "SVX_URL" : SVX_URL, + "TEMPLATE_DIRS" : TEMPLATE_DIRS, + "THREEDCACHEDIR" : THREEDCACHEDIR, + "TINY_MCE_MEDIA_ROOT" : TINY_MCE_MEDIA_ROOT, + "TINY_MCE_MEDIA_URL" : TINY_MCE_MEDIA_URL, + "TUNNEL_DATA" : TUNNEL_DATA, + "URL_ROOT" : URL_ROOT + } + + ncodes = len(pathsdict) + bycodeslist = sorted(pathsdict.iteritems()) + bypathslist = sorted(pathsdict.iteritems(), key=lambda x: x[1]) + + return render(request, 'pathsreport.html', { + "pathsdict":pathsdict, + "bycodeslist":bycodeslist, + "bypathslist":bypathslist, + "ncodes":ncodes}) + + + def experimental(request): legsbyexpo = [ ] for expedition in Expedition.objects.all(): diff --git a/pathreport.py b/pathreport.py new file mode 100644 index 0000000..fd840b2 --- /dev/null +++ b/pathreport.py @@ -0,0 +1,60 @@ +#!/usr/bin/python +from settings import * +import sys +import os +import string +import re +import urlparse +import django + +pathsdict={ +"ADMIN_MEDIA_PREFIX" : ADMIN_MEDIA_PREFIX, +"ADMIN_MEDIA_PREFIX" : ADMIN_MEDIA_PREFIX, +"CAVEDESCRIPTIONSX" : CAVEDESCRIPTIONS, +"DIR_ROOT" : DIR_ROOT, +"EMAIL_HOST" : EMAIL_HOST, +"EMAIL_HOST_USER" : EMAIL_HOST_USER, +"ENTRANCEDESCRIPTIONS" : ENTRANCEDESCRIPTIONS, +"EXPOUSER_EMAIL" : EXPOUSER_EMAIL, +"EXPOUSERPASS" :"", +"EXPOUSER" : EXPOUSER, +"EXPOWEB" : EXPOWEB, +"EXPOWEB_URL" : EXPOWEB_URL, +"FILES" : FILES, +"JSLIB_URL" : JSLIB_URL, +"LOGFILE" : LOGFILE, +"LOGIN_REDIRECT_URL" : LOGIN_REDIRECT_URL, +"MEDIA_ADMIN_DIR" : MEDIA_ADMIN_DIR, +"MEDIA_ROOT" : MEDIA_ROOT, +"MEDIA_URL" : MEDIA_URL, +"PHOTOS_ROOT" : PHOTOS_ROOT, +"PHOTOS_URL" : PHOTOS_URL, +"PYTHON_PATH" : PYTHON_PATH, +"REPOS_ROOT_PATH" : REPOS_ROOT_PATH, +"ROOT_URLCONF" : ROOT_URLCONF, +"STATIC_ROOT" : STATIC_ROOT, +"STATIC_URL" : STATIC_URL, +"SURVEX_DATA" : SURVEX_DATA, +"SURVEY_SCANS" : SURVEY_SCANS, +"SURVEYS" : SURVEYS, +"SURVEYS_URL" : SURVEYS_URL, +"SVX_URL" : SVX_URL, +"TEMPLATE_DIRS" : TEMPLATE_DIRS, +"THREEDCACHEDIR" : THREEDCACHEDIR, +"TINY_MCE_MEDIA_ROOT" : TINY_MCE_MEDIA_ROOT, +"TINY_MCE_MEDIA_URL" : TINY_MCE_MEDIA_URL, +"TUNNEL_DATA" : TUNNEL_DATA, +"URL_ROOT" : URL_ROOT +} + +sep="\r\t\t\t" # ugh nasty - terminal output only +sep2="\r\t\t\t\t\t\t\t" # ugh nasty - terminal output only + +bycodes = sorted(pathsdict) +for p in bycodes: + print p, sep , pathsdict[p] + +byvals = sorted(pathsdict, key=pathsdict.__getitem__) +for p in byvals: + print pathsdict[p] , sep2, p + \ No newline at end of file diff --git a/templates/pathsreport.html b/templates/pathsreport.html new file mode 100644 index 0000000..79effee --- /dev/null +++ b/templates/pathsreport.html @@ -0,0 +1,45 @@ +{% extends "base.html" %} +{% load wiki_markup %} +{% load link %} + +{% block title %}Troggle paths report{% endblock %} + +{% block content %} + +

Expo Troggle paths report

+ + +

+ + + +{% for c,p in bycodeslist %} + + + + +{% endfor %} +
CodePath
+ {{c}} + + {{p}} +
+ +

+ + +{% for c,p in bypathslist %} + + + + +{% endfor %} +
PathCode
+ {{p}} + + {{c}} +
+

+There are {{ ncodes }} different path codes defined. +{% endblock %} + diff --git a/urls.py b/urls.py index 2a30faf..281e189 100644 --- a/urls.py +++ b/urls.py @@ -157,6 +157,7 @@ actualurlpatterns = patterns('', # for those silly ideas url(r'^experimental.*$', views_logbooks.experimental, name="experimental"), + url(r'^pathsreport.*$', views_logbooks.pathsreport, name="pathsreport"), #url(r'^trip_report/?$',views_other.tripreport,name="trip_report")