Merge lp:~bac/launchpad/bug-496701-mimetypes into lp:launchpad/db-devel

Proposed by Brad Crittenden
Status: Merged
Merged at revision: not available
Proposed branch: lp:~bac/launchpad/bug-496701-mimetypes
Merge into: lp:launchpad/db-devel
Diff against target: 51 lines (+11/-5)
3 files modified
buildout.cfg (+4/-0)
lib/lp/services/tests/test_mime.py (+7/-1)
lib/site.py (+0/-4)
To merge this branch: bzr merge lp:~bac/launchpad/bug-496701-mimetypes
Reviewer Review Type Date Requested Status
Данило Шеган (community) release-critical Approve
Curtis Hovey (community) code Approve
Review via email: mp+16170@code.launchpad.net

Commit message

Move initialization code to buildout.cfg from site.py.

To post a comment you must log in.
Revision history for this message
Brad Crittenden (bac) wrote :

= Summary =

The initialization added to lib/site.py to modify the mimetypes standard library is
not functioning as planned. Moving the initialization to buildout.cfg, as Gary
initially suggested, does work.

== Proposed fix ==

Move init calls to the [scripts] section of buildout.cfg. A more standard place will
be provided by the foundations team in the near future.

== Pre-implementation notes ==

Call with Gary.

== Implementation details ==

As above.

== Tests ==

Interactive tests to prove the intialization has worked.

== Demo and Q/A ==

Perform the QA for bug 490224 and ensure it now works.

= Launchpad lint =

Checking for conflicts. and issues in doctests and templates.
Running jslint, xmllint, pyflakes, and pylint.
Using normal rules.

Linting changed files:
  buildout.cfg
  lib/site.py

Revision history for this message
Curtis Hovey (sinzui) wrote :

I see that this change is to the python env, not Launchpad, because it is the only guaranteed location to support our desire for a single mimetypes that just works. This is good to land since we do need this.

We can reconsider this if we get site.py work as we expect, or Python 2.6 works as we require.

review: Approve (code)
Revision history for this message
Данило Шеган (danilo) wrote :

Ok, looking how it's a simple change and result of a QA-BAD on previous fix, I am ok-ing this. Since there are no automated tests here (why?), please do serious QA on staging as soon as this shows up (and as a reminder, staging gets code updated from db-stable every half an hour as long as there are no DB patches).

review: Approve (release-critical)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'buildout.cfg'
2--- buildout.cfg 2009-11-23 04:09:44 +0000
3+++ buildout.cfg 2009-12-16 03:50:30 +0000
4@@ -64,6 +64,10 @@
5 'ignore',
6 'Module .+ was already imported from .+, but .+ is being added.*',
7 UserWarning)
8+ # XXX: BradCrittenden 2009-12-14 bug=496705: A single, well-known entry point
9+ # for initialization work needs to be created.
10+ from lp.services.mime import customizeMimetypes
11+ customizeMimetypes()
12 entry-points = stxdocs=zope.configuration.stxdocs:main
13 googletestservice=canonical.launchpad.testing.googletestservice:main
14 windmill=windmill.bin.windmill_bin:main
15
16=== modified file 'lib/lp/services/tests/test_mime.py'
17--- lib/lp/services/tests/test_mime.py 2009-12-10 23:01:23 +0000
18+++ lib/lp/services/tests/test_mime.py 2009-12-16 03:50:30 +0000
19@@ -9,6 +9,13 @@
20
21 import mimetypes
22 from lp.testing import TestCase
23+from lp.services.mime import customizeMimetypes
24+
25+
26+# In our run-time environment this call is made via the initialization section
27+# of buildout.cfg but that initialization is not done for tests so it must be
28+# done manually here.
29+customizeMimetypes()
30
31
32 class TestBzip(TestCase):
33@@ -36,6 +43,5 @@
34 self.assertEqual('bzip2', encoding)
35
36
37-
38 def test_suite():
39 return unittest.TestLoader().loadTestsFromName(__name__)
40
41=== modified file 'lib/site.py'
42--- lib/site.py 2009-12-09 11:47:58 +0000
43+++ lib/site.py 2009-12-16 03:50:30 +0000
44@@ -28,7 +28,3 @@
45 import sys
46 execfile(
47 os.path.join(sys.prefix, 'lib', 'python' + sys.version[:3], 'site.py'))
48-
49-# Perform other start-up initialization.
50-from lp.services.mime import customizeMimetypes
51-customizeMimetypes()

Subscribers

People subscribed via source and target branches

to status/vote changes: