Doc page about Exceptions is blank

Bug #1276243 reported by Julie Pichon on 2014-02-04
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Medium
Kirill Izotov

Bug Description

The "Exceptions" page in the Horizon developer documentations is currently showing blank:

http://docs.openstack.org/developer/horizon/ref/exceptions.html

It shouldn't be, there are a lot of docstrings in the exceptions file that should automatically be in there.

https://github.com/openstack/horizon/blob/master/horizon/exceptions.py

Julie Pichon (jpichon) on 2014-02-04
description: updated
Floren (florenllanos) on 2014-02-05
Changed in horizon:
status: New → Confirmed
Kirill Izotov (enykeev) wrote :

It seems like we are having some kind of a circular dependency with django.contrib.auth.

Traceback (most recent call last):ptions
  File "/Users/enykeev/Developer/Work/Openstack/horizon/.venv/lib/python2.7/site-packages/sphinx/ext/autodoc.py", line 321, in import_object
    __import__(self.modname)
  File "/Users/enykeev/Developer/Work/Openstack/horizon/horizon/exceptions.py", line 25, in <module>
    from django.contrib.auth import logout # noqa
  File "/Users/enykeev/Developer/Work/Openstack/horizon/.venv/lib/python2.7/site-packages/django/contrib/auth/__init__.py", line 5, in <module>
    from django.middleware.csrf import rotate_token
  File "/Users/enykeev/Developer/Work/Openstack/horizon/.venv/lib/python2.7/site-packages/django/middleware/csrf.py", line 16, in <module>
    from django.utils.cache import patch_vary_headers
  File "/Users/enykeev/Developer/Work/Openstack/horizon/.venv/lib/python2.7/site-packages/django/utils/cache.py", line 26, in <module>
    from django.core.cache import get_cache
  File "/Users/enykeev/Developer/Work/Openstack/horizon/.venv/lib/python2.7/site-packages/django/core/cache/__init__.py", line 70, in <module>
    if DEFAULT_CACHE_ALIAS not in settings.CACHES:
  File "/Users/enykeev/Developer/Work/Openstack/horizon/.venv/lib/python2.7/site-packages/django/conf/__init__.py", line 53, in __getattr__
    self._setup(name)
  File "/Users/enykeev/Developer/Work/Openstack/horizon/.venv/lib/python2.7/site-packages/django/conf/__init__.py", line 48, in _setup
    self._wrapped = Settings(settings_module)
  File "/Users/enykeev/Developer/Work/Openstack/horizon/.venv/lib/python2.7/site-packages/django/conf/__init__.py", line 132, in __init__
    mod = importlib.import_module(self.SETTINGS_MODULE)

-- I've hacked it a bit by disabling "try except" in django/conf/__init__.py to see the full trace --

  File "/Users/enykeev/Developer/Work/Openstack/horizon/.venv/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module
    __import__(name)
  File "/Users/enykeev/Developer/Work/Openstack/horizon/openstack_dashboard/settings.py", line 246, in <module>
    from openstack_dashboard import policy
  File "/Users/enykeev/Developer/Work/Openstack/horizon/openstack_dashboard/policy.py", line 27, in <module>
    from openstack_auth import utils as auth_utils
  File "/Users/enykeev/Developer/Work/Openstack/horizon/.venv/lib/python2.7/site-packages/openstack_auth/utils.py", line 17, in <module>
    from django.contrib import auth
ImportError: cannot import name auth

So, the question here is where should we fix that? My modest experience with Django tells me that we really shouldn't import something from django from inside the openstack_horizon.settings, so the closest point of failure is an import statement within policy.py, which should be moved inside 'check' function.

Fix proposed to branch: master
Review: https://review.openstack.org/71851

Changed in horizon:
assignee: nobody → Kirill Izotov (enykeev)
status: Confirmed → In Progress
Kirill Izotov (enykeev) wrote :

Also, by fixing this bug, i have uncovered another one related to Sphinx not being able to autodocument functions with @cached_property decorator.

Traceback (most recent call last):de/openstack_dashboard/openstack_dashboard.api.nova
  File "/Users/enykeev/Developer/Work/Openstack/horizon/.venv/lib/python2.7/site-packages/sphinx/ext/autodoc.py", line 326, in import_object
    obj = self.get_attr(obj, part)
  File "/Users/enykeev/Developer/Work/Openstack/horizon/.venv/lib/python2.7/site-packages/sphinx/ext/autodoc.py", line 232, in get_attr
    return safe_getattr(obj, name, *defargs)
  File "/Users/enykeev/Developer/Work/Openstack/horizon/.venv/lib/python2.7/site-packages/sphinx/util/inspect.py", line 70, in safe_getattr
    raise AttributeError(name)
AttributeError: rules

It looks like something between Sphinx and Django, but i haven't found any records of that neither in google nor in sphinx tracker, so i've decided to brought that up here in case you might already know something about it.

Ana Krivokapić (akrivoka) wrote :

FWIW, I have reported that bug months ago: https://bugs.launchpad.net/horizon/+bug/1257725. I'm not sure what the cause is either.

Thierry Carrez (ttx) on 2014-03-05
Changed in horizon:
milestone: icehouse-3 → icehouse-rc1

Reviewed: https://review.openstack.org/71851
Committed: https://git.openstack.org/cgit/openstack/horizon/commit/?id=8a237ea34d02100e0e75e14370b4b6b9b5a10083
Submitter: Jenkins
Branch: master

commit 8a237ea34d02100e0e75e14370b4b6b9b5a10083
Author: Kirill Izotov <email address hidden>
Date: Fri Feb 7 17:01:53 2014 +0700

    Fix Exceptions doc page generation

    The problem caused by circular import of django.contrib.auth
    by both horizon.exceptions and openstack_auth.utils
    (through openstack_dashboard.settings)

    Change-Id: I7ad178f5dd7f43bf95a3b2091113725c3415533f
    Closes-Bug: #1276243

Changed in horizon:
status: In Progress → Fix Committed
Thierry Carrez (ttx) on 2014-03-31
Changed in horizon:
status: Fix Committed → Fix Released
Thierry Carrez (ttx) on 2014-04-17
Changed in horizon:
milestone: icehouse-rc1 → 2014.1
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers