[Patchew-devel] [PATCH 1/2] Text to json converter for mbox

Paolo Bonzini pbonzini at redhat.com
Wed May 9 14:48:46 UTC 2018


On 09/05/2018 15:53, Shubham Jain wrote:
> 
> 
>     I still don't understand why you cannot use AddressSerializer just like
>     you use DateTimeField though.  DRF serializers in general are
>     independent from models.  The code is fine, so this is just for my
>     personal enlightenment. :) Did you get an error?
> 
> Yes, This is the traceback 
> File "/Users/Desktop/patchew/api/models.py", line 25, in <module>
>     from mbox import MboxMessage
>   File "/Users/Desktop/patchew/mbox.py", line 17, in <module>
>     from api.rest import AddressSerializer
>   File "/Users/Desktop/patchew/api/rest.py", line 17, in <module>
>     from .models import Project, Message
> ImportError: cannot import name 'Project' 

Oh, interesting. I have no clues.

>     The dependency of mbox on api.rest would be very ugly, but it is easy to
>     avoid, just move the whole class to mbox.py.
> 
> add_db_to_rest is defined in the mbox. This makes us independent of
> api.rest, right?

Yes, I mean we could also move AddressSerializer to mbox and keep it
independent of api.rest.

Paolo




More information about the Patchew-devel mailing list