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
1=== modified file 'src/lazr/restful/frameworks/django.py'
2--- src/lazr/restful/frameworks/django.py 2009-09-08 12:00:21 +0000
3+++ src/lazr/restful/frameworks/django.py 2011-10-10 09:58:33 +0000
4@@ -10,15 +10,12 @@
5 'ManagerSequencer',
6 ]
7
8-import settings
9-
10 import martian
11
12 from zope.interface import Interface, implements
13 from zope.interface.common.sequence import IFiniteSequence
14 from zope.location.interfaces import ILocation
15 from zope.schema import getFieldsInOrder
16-from zope.traversing.browser.interfaces import IAbsoluteURL
17 from zope.traversing.browser.absoluteurl import AbsoluteURL
18
19 import grokcore.component
20@@ -29,10 +26,11 @@
21 'django.core.exceptions', {}).core.exceptions.ObjectDoesNotExist
22 Manager = __import__(
23 'django.db.models.manager', {}).db.models.manager.Manager
24+settings = __import__('django.conf', {}).conf.settings
25
26 from lazr.restful import directives
27 from lazr.restful.interfaces import (
28- IWebServiceLayer, IWebServiceClientRequest, IWebServiceConfiguration)
29+ IWebServiceClientRequest, IWebServiceConfiguration)
30 from lazr.restful.error import NotFoundView
31 from lazr.restful.simple import BaseWebServiceConfiguration
32

Subscribers

People subscribed via source and target branches