[openstack-dev] HACKING and new-style relative imports

Sean Dague sean at dague.net
Tue Jul 9 11:57:31 UTC 2013


On 07/09/2013 07:28 AM, Kieran Spear wrote:
> Hi all,
>
> There's a review up to make Horizon pass H304 (no relative imports):
>
> https://review.openstack.org/#/c/35664/
>
> Old-style relative imports are dangerous, but I can't think of a good enough reason to forbid new-style imports, e.g.:
>
> from .views import IndexView
>
> instead of
>
> from openstack_dashboard.dashboards.project.images_and_snapshots.views \
>        import IndexView

However, if you decide to address H302, most of the over 80 character 
issues in horizon are going to fit, as this would become:

from openstack_dashboard.dashboards.project.images_and_snapshots import 
views

(tacking in at 78 chars)

I'm sure there will still be a few which break the limit... but that 
will fix a lot of them (from what I see in the review).

	-Sean

-- 
Sean Dague
http://dague.net



More information about the OpenStack-dev mailing list