Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #2 #3

Closed
wants to merge 1 commit into from
Closed

Fixes #2 #3

wants to merge 1 commit into from

Conversation

ldgarcia
Copy link

No description provided.

@ldgarcia
Copy link
Author

Regarding the second issue, should we move it to a separate issue?

@miki725
Copy link
Owner

miki725 commented Apr 2, 2014

Will look into this. However I dont like removing the imports in __init__.py because I would like to be able to import directly from the package:

from rest_framework_bulk import SomeMixin

If this is the only way to fix #2, then Ill merge this but I would like to find a better way.

@kevin-brown
Copy link
Contributor

Can't this be fixed by making the imports within __init__.py more specific? So instead of importing all, you would specific import the mixins and classes.

The other option would be to specify __all__ within mixins.py and generics.py, so the mixins import isn't overridden.

@miki725
Copy link
Owner

miki725 commented Apr 2, 2014

What I don't get is how imports in __init__.py affect from rest_framework_bulk import mixins. There you explicitly specify the module to import from.

@kevin-brown
Copy link
Contributor

@miki725 It appears as though the import chain is going like this:

[0]:1           from rest_framework_bulk import mixins as bulk_mixins
__init__.py:5   from .generics import *
generics.py:2   from rest_framework import mixins

This is because Python will import rest_framework_bulk before it imports mixins from it, so it doesn't quite work how you'd want it to.

>>> from rest_framework_bulk import mixins
>>> mixins
<module 'rest_framework.mixins' from '/var/sandbox/.virtualenvs/test/local/lib/python2.7/site-packages/rest_framework/mixins.pyc'>

@miki725
Copy link
Owner

miki725 commented Apr 2, 2014

Oh. That makes sense now. Then Ill just rename the mixins.py to bulk_mixins.py to fix this. I still would like to import things in __init__.py. Thanks for the explanation. If you want to send another PR with that, you are more then welcome to.

@miki725
Copy link
Owner

miki725 commented Apr 2, 2014

Closing this since I like the #5 approach a little better.

@miki725 miki725 closed this Apr 2, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants