← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~gary/launchpad/bug632218 into lp:launchpad

 

You have been requested to review the proposed merge of lp:~gary/launchpad/bug632218 into lp:launchpad.

This is a release-critical branch to fix a critical bug.

The symptoms are described in the bug report.

LOSAs are hopefully going to verify the fix in production in a few hours.  Meanwhile, I plan to go ahead and try to get this merged, because I believe it will work.

To fix this problem, I took the approach of adding an explicit step for compiling the templates within make compile.  The cheapest yet most comprehensive way I could think of to do this was to process Launchpad's zcml.  This should load all of our normal templates in the future.  For now, it loads the Python file that registers the ++profile++ adapter and thus processes the template.  You could argue that this is a side effect, and it is, but a defensible one: if zcml registers a view, the view should be instantiated with its template in order to be registered.  If we ever want to allow for lazy template generation for some reason, we can deal with that then, and I don't see a big advantage for us anyway.

This also makes "make clean" clean up .pt.py files generated by chameleon.

-- 
https://code.launchpad.net/~gary/launchpad/bug632218/+merge/34785
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~gary/launchpad/bug632218 into lp:launchpad.
=== modified file 'Makefile'
--- Makefile	2010-09-07 05:39:39 +0000
+++ Makefile	2010-09-07 18:22:40 +0000
@@ -202,11 +202,14 @@
 	$(SHHH) PYTHONPATH= ./bin/buildout \
                 configuration:instance_name=${LPCONFIG} -c $(BUILDOUT_CFG)
 
+# bin/compile_templates is responsible for building all chameleon templates,
+# of which there is currently one, but of which many more are coming.
 compile: $(PY) $(BZR_VERSION_INFO)
 	mkdir -p /var/tmp/vostok-archive
 	${SHHH} $(MAKE) -C sourcecode build PYTHON=${PYTHON} \
 	    LPCONFIG=${LPCONFIG}
 	${SHHH} LPCONFIG=${LPCONFIG} ${PY} -t buildmailman.py
+	bin/compile_templates
 
 test_build: build
 	bin/test $(TESTFLAGS) $(TESTOPTS)
@@ -337,7 +340,8 @@
 	fi
 	find . -path ./eggs -prune -false -o \
 		-type f \( -name '*.o' -o -name '*.so' -o -name '*.la' -o \
-	    -name '*.lo' -o -name '*.py[co]' -o -name '*.dll' \) \
+	    -name '*.lo' -o -name '*.py[co]' -o -name '*.dll' -o \
+	    -name '*.pt.py' \) \
 	    -print0 | xargs -r0 $(RM)
 	$(RM) thread*.request
 	$(RM) -r lib/mailman

=== modified file 'setup.py'
--- setup.py	2010-07-23 08:50:49 +0000
+++ setup.py	2010-09-07 18:22:40 +0000
@@ -149,6 +149,8 @@
             'start_librarian '
                 '= canonical.launchpad.scripts.runlaunchpad:start_librarian',
             'ec2 = devscripts.ec2test.entrypoint:main',
+            'compile_templates '
+                '= canonical.launchpad.scripts:execute_zcml_for_scripts',
         ]
     ),
 )


References