summaryrefslogtreecommitdiffstats
path: root/core/utils.py
diff options
context:
space:
mode:
authorPhilip Sargent <philip.sargent@klebos.com>2021-05-04 20:57:16 +0100
committerPhilip Sargent <philip.sargent@klebos.com>2021-05-04 20:57:16 +0100
commit1638f97d0c785832ad9c6456f109971d5171c5e7 (patch)
tree9f222e86fde21a90374574e2f3258a5c0ae7e6fe /core/utils.py
parentb3fcd7765e4b8cc55ec9b4f433d34cd89ae3bce9 (diff)
downloadtroggle-1638f97d0c785832ad9c6456f109971d5171c5e7.tar.gz
troggle-1638f97d0c785832ad9c6456f109971d5171c5e7.tar.bz2
troggle-1638f97d0c785832ad9c6456f109971d5171c5e7.zip
moved functions between files
Diffstat (limited to 'core/utils.py')
-rw-r--r--core/utils.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/core/utils.py b/core/utils.py
index ff5f35c..fe5bd07 100644
--- a/core/utils.py
+++ b/core/utils.py
@@ -63,6 +63,23 @@ def chaosmonkey(n):
# print("CHAOS strikes !", file=sys.stderr)
return True
+# handles url or file, so we can refer to a set of scans (not drawings) on another server
+def GetListDir(sdir):
+ res = [ ]
+ if sdir[:7] == "http://":
+ # s = urllib.request.urlopen(sdir)
+ message = f"! Requesting loading from http:// NOT IMPLEMENTED. [{sdir}]"
+ print(message)
+ DataIssue.objects.create(parser='Drawings', message=message)
+ sdir[:7] = ""
+
+ for f in os.listdir(sdir):
+ if f[0] != ".":
+ ff = os.path.join(sdir, f)
+ res.append((f, ff, os.path.isdir(ff)))
+ return res
+
+
def save_carefully(objectType, lookupAttribs={}, nonLookupAttribs={}):
"""Looks up instance using lookupAttribs and carries out the following: