Merge lp:~michael.nelson/lazr.restful/663155-fix-django-settings-import into lp:lazr.restful

Proposed by Michael Nelson
Status: Rejected
Rejected by: Francis J. Lacoste
Proposed branch: lp:~michael.nelson/lazr.restful/663155-fix-django-settings-import
Merge into: lp:lazr.restful
Diff against target: 31 lines (+2/-4)
1 file modified
src/lazr/restful/frameworks/django.py (+2/-4)
To merge this branch: bzr merge lp:~michael.nelson/lazr.restful/663155-fix-django-settings-import
Reviewer Review Type Date Requested Status
Francis J. Lacoste (community) Needs Resubmitting
Aaron Bentley (community) Approve
Review via email: mp+78810@code.launchpad.net

Description of the change

Load django.conf.settings rather than the settings module directly.

Note: as per bug 663155, this module could be updated to use absolute imports (and therefore simplify this and all tho similar imports in the file.)

To post a comment you must log in.
Revision history for this message
Aaron Bentley (abentley) :
review: Approve
Revision history for this message
Francis J. Lacoste (flacoste) wrote :

I'm actually getting tests failure after merging this branch:

----------------------------------------------------------------------
File "/home/francis/canonical/lazr.restful/trunk/src/lazr/restful/docs/django.txt", line 65, in django.txt
Failed example:
    ignore = xmlconfig.string("""
      <configure xmlns="http://namespaces.zope.org/zope">
        <include package="lazr.restful" file="basic-site.zcml" />
        <include package="lazr.restful.frameworks" file="django.zcml" />
      </configure>
    """)
Exception raised:
    Traceback (most recent call last):
      ....

      File "/home/francis/canonical/lazr.restful/trunk/src/lazr/restful/framewor
ks/django.py", line 29, in <module>
        settings = __import__('django.conf', {}).conf.settings
    ZopeXMLConfigurationError: File "<string>", line 4.4-4.68
        ZopeXMLConfigurationError: File "/home/francis/canonical/lazr.restful/trunk/src/lazr/restful/frameworks/django.zcml", line 3.2-3.56
        ImportError: No module named conf
----------------------------------------------------------------------

review: Needs Resubmitting

Unmerged revisions

154. By Michael Nelson

Fix the import of django settings to use django.conf.settings rather than the project module directly.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/lazr/restful/frameworks/django.py'
--- src/lazr/restful/frameworks/django.py 2009-09-08 12:00:21 +0000
+++ src/lazr/restful/frameworks/django.py 2011-10-10 09:58:33 +0000
@@ -10,15 +10,12 @@
10 'ManagerSequencer',10 'ManagerSequencer',
11 ]11 ]
1212
13import settings
14
15import martian13import martian
1614
17from zope.interface import Interface, implements15from zope.interface import Interface, implements
18from zope.interface.common.sequence import IFiniteSequence16from zope.interface.common.sequence import IFiniteSequence
19from zope.location.interfaces import ILocation17from zope.location.interfaces import ILocation
20from zope.schema import getFieldsInOrder18from zope.schema import getFieldsInOrder
21from zope.traversing.browser.interfaces import IAbsoluteURL
22from zope.traversing.browser.absoluteurl import AbsoluteURL19from zope.traversing.browser.absoluteurl import AbsoluteURL
2320
24import grokcore.component21import grokcore.component
@@ -29,10 +26,11 @@
29 'django.core.exceptions', {}).core.exceptions.ObjectDoesNotExist26 'django.core.exceptions', {}).core.exceptions.ObjectDoesNotExist
30Manager = __import__(27Manager = __import__(
31 'django.db.models.manager', {}).db.models.manager.Manager28 'django.db.models.manager', {}).db.models.manager.Manager
29settings = __import__('django.conf', {}).conf.settings
3230
33from lazr.restful import directives31from lazr.restful import directives
34from lazr.restful.interfaces import (32from lazr.restful.interfaces import (
35 IWebServiceLayer, IWebServiceClientRequest, IWebServiceConfiguration)33 IWebServiceClientRequest, IWebServiceConfiguration)
36from lazr.restful.error import NotFoundView34from lazr.restful.error import NotFoundView
37from lazr.restful.simple import BaseWebServiceConfiguration35from lazr.restful.simple import BaseWebServiceConfiguration
3836

Subscribers

People subscribed via source and target branches