[Python-apps-team] Bug#824347: patches from philp

Antoine Beaupré anarcat at debian.org
Sat May 14 20:06:36 UTC 2016


Actually, I was wondering how this could possibly be working at all, and
I looked at the deployed instance on debian.org. It turns out there's a
patch sitting there, uncommitted:

anarcat at philp:/srv/planet.debian.org/code/venus$ git diff
diff --git a/planet/shell/dj.py b/planet/shell/dj.py
index d2199fc..f26b8da 100644
--- a/planet/shell/dj.py
+++ b/planet/shell/dj.py
@@ -19,7 +19,7 @@ def run(script, doc, output_file=None, options={}):
     # I need to re-import the settings at every call because I have to 
     # set the TEMPLATE_DIRS variable programmatically
     from django.conf import settings
-    settings._wrapped=None
+    #settings._wrapped=None
     try:
         settings.configure(
             DEBUG=True, TEMPLATE_DEBUG=True, 
@@ -27,6 +27,11 @@ def run(script, doc, output_file=None, options={}):
             )
     except EnvironmentError:
         pass
+    except RuntimeError:
+        settings.TEMPLATE_DIRS=(os.path.dirname(script),)
+
+    import django
+    django.setup()
     from django.template import Context
     from django.template.loader import get_template
 
Maybe those 2 (3?) chunks are unrelated but they are certainly relevant
in the discussion here!

A.

-- 
Arguing for surveillance because you have nothing to hide is no
different than making the claim, "I don't care about freedom of speech
because I have nothing to say."
                        - Edward Snowden



More information about the Python-apps-team mailing list