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
=== modified file 'buildout.cfg'
--- buildout.cfg 2009-11-23 04:09:44 +0000
+++ buildout.cfg 2009-12-16 03:50:30 +0000
@@ -64,6 +64,10 @@
64 'ignore',64 'ignore',
65 'Module .+ was already imported from .+, but .+ is being added.*',65 'Module .+ was already imported from .+, but .+ is being added.*',
66 UserWarning)66 UserWarning)
67 # XXX: BradCrittenden 2009-12-14 bug=496705: A single, well-known entry point
68 # for initialization work needs to be created.
69 from lp.services.mime import customizeMimetypes
70 customizeMimetypes()
67entry-points = stxdocs=zope.configuration.stxdocs:main71entry-points = stxdocs=zope.configuration.stxdocs:main
68 googletestservice=canonical.launchpad.testing.googletestservice:main72 googletestservice=canonical.launchpad.testing.googletestservice:main
69 windmill=windmill.bin.windmill_bin:main73 windmill=windmill.bin.windmill_bin:main
7074
=== modified file 'lib/lp/services/tests/test_mime.py'
--- lib/lp/services/tests/test_mime.py 2009-12-10 23:01:23 +0000
+++ lib/lp/services/tests/test_mime.py 2009-12-16 03:50:30 +0000
@@ -9,6 +9,13 @@
99
10import mimetypes10import mimetypes
11from lp.testing import TestCase11from lp.testing import TestCase
12from lp.services.mime import customizeMimetypes
13
14
15# In our run-time environment this call is made via the initialization section
16# of buildout.cfg but that initialization is not done for tests so it must be
17# done manually here.
18customizeMimetypes()
1219
1320
14class TestBzip(TestCase):21class TestBzip(TestCase):
@@ -36,6 +43,5 @@
36 self.assertEqual('bzip2', encoding)43 self.assertEqual('bzip2', encoding)
3744
3845
39
40def test_suite():46def test_suite():
41 return unittest.TestLoader().loadTestsFromName(__name__)47 return unittest.TestLoader().loadTestsFromName(__name__)
4248
=== modified file 'lib/site.py'
--- lib/site.py 2009-12-09 11:47:58 +0000
+++ lib/site.py 2009-12-16 03:50:30 +0000
@@ -28,7 +28,3 @@
28import sys28import sys
29execfile(29execfile(
30 os.path.join(sys.prefix, 'lib', 'python' + sys.version[:3], 'site.py'))30 os.path.join(sys.prefix, 'lib', 'python' + sys.version[:3], 'site.py'))
31
32# Perform other start-up initialization.
33from lp.services.mime import customizeMimetypes
34customizeMimetypes()

Subscribers

People subscribed via source and target branches

to status/vote changes: