On Mon, Sep 7, 2009 at 6:21 AM, Sven Richter <[email protected]> wrote:

> Hi all,
>
> i must have a simple error somewhere in my code, everytime i try to import
> a certain method i get the following error:
> cannot import name send_entry_created
>
> This is my code:
> entry.models:
> from entry.signals import send_entry_created
> ...
>
> dispatcher.connect(send_entry_created, signal=signals.post_save,
>         sender=Entries)
>
> entry.signals:
> from entry.models import Entries
>
> def send_entry_created(sender, instance, signal, *args, **kwargs):
>     if 'created' in kwargs:
>         if kwargs['created']:
>             print 'new'
>     try:
>         Entries.objects.get(id=instance._get_pk_val())
>     except (Entries.DoesNotExist, AssertionError):
>         print 'nsrd'
>
> Where signals is a file living in the entry app.
>
> Can someone point me to the error please?
>
>
Looks like you may have a circular dependency.  Your entry.models file is
trying to import send_entry_created from entry.signals but entry.signals
then attempts to import Entries from entry.models, which leads to trying to
import send_entry_created from entry.signals again and instead of entering
an infinite loop Python reports the error.  You need to structure your
code/imports so that there are no circular imports.

Karen

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to