Re: Thoughts on defining and autoimporting signals.py
On 15 janv. 2014, at 15:01, Ihor Kaharlichenkowrote: > It's already 1.6 now, are there any news regarding this issue? It’s fixed in 1.7. Search for “app-loading” in the archives of this list. > From what I see the aren't any updates in signals docs. Look again: https://github.com/django/django/commits/master/docs/ref/signals.txt > It would be really nice if there was an official, "the Django way" for where > to put signals, where to put handlers, where to wire them up, and how to test > all that stuff. There will be in 1.7: https://github.com/django/django/commit/c31d7c48139260ccb72deda9b0033db0db86e84a -- Aymeric. -- You received this message because you are subscribed to the Google Groups "Django developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To post to this group, send email to django-developers@googlegroups.com. Visit this group at http://groups.google.com/group/django-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/AED1570D-98A2-4100-B163-5399CF716240%40polytechnique.org. For more options, visit https://groups.google.com/groups/opt_out.
Re: Thoughts on defining and autoimporting signals.py
Hi. > The bad news is that the patch has been languishing in need of review > for a while. At this point, it almost certainly won't make 1.4; if it > can get some attention, it would be a welcome addition to 1.5. > It's already 1.6 now, are there any news regarding this issue? From what I see the aren't any updates in signals docs. Maybe there is a ticket one could track? It would be really nice if there was an official, "the Django way" for where to put signals, where to put handlers, where to wire them up, and how to test all that stuff. Regards, Ihor. > -- You received this message because you are subscribed to the Google Groups "Django developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To post to this group, send email to django-developers@googlegroups.com. Visit this group at http://groups.google.com/group/django-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/a495a762-a140-4c92-9ca6-5b2132b33396%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Thoughts on defining and autoimporting signals.py
On Jan 19, 8:44 pm, Emil Stenströmwrote: > On Thursday, 22 December 2011 03:49:44 UTC+1, Russell Keith-Magee wrote: > > ... there isn't a single solution that will work > > everywhere, which one of the reasons that the docs are silent on the > > issue. > > Just for the record: The docs are actually telling you to put your signals > in models.py, at the end > of:https://docs.djangoproject.com/en/dev/topics/signals/#s-receiver-func... > > I would much rather have them point people to signals.py, and an import > signals.py in __init__.py. I've seen beginners be trapped in the circular > import loop when trying to move their signals to a separate file, not > realizing that they also need to move the import of signals.py away from > models to be able to use Model classes inside signals. The problem with importing them from __init__.py is that it breaks coverage as the signals and the models get imported before the coverage tools are loaded when using things nose, django nose and nose coverage. Kirit -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.
Re: Thoughts on defining and autoimporting signals.py
+1, I think they ought to be auto imported just like models.py, views.py, etc. are. From: Emil Stenström Sent: Thursday, January 19, 2012 8:44 AM To: django-developers@googlegroups.com Subject: Re: Thoughts on defining and autoimporting signals.py On Thursday, 22 December 2011 03:49:44 UTC+1, Russell Keith-Magee wrote: ... there isn't a single solution that will work everywhere, which one of the reasons that the docs are silent on the issue. Just for the record: The docs are actually telling you to put your signals in models.py, at the end of: https://docs.djangoproject.com/en/dev/topics/signals/#s-receiver-functions I would much rather have them point people to signals.py, and an import signals.py in __init__.py. I've seen beginners be trapped in the circular import loop when trying to move their signals to a separate file, not realizing that they also need to move the import of signals.py away from models to be able to use Model classes inside signals. -- You received this message because you are subscribed to the Google Groups "Django developers" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-developers/-/RA_A6SsBM-YJ. To post to this group, send email to django-developers@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en. -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.
Re: Thoughts on defining and autoimporting signals.py
On Thursday, 22 December 2011 03:49:44 UTC+1, Russell Keith-Magee wrote: > ... there isn't a single solution that will work > everywhere, which one of the reasons that the docs are silent on the > issue. > Just for the record: The docs are actually telling you to put your signals in models.py, at the end of: https://docs.djangoproject.com/en/dev/topics/signals/#s-receiver-functions I would much rather have them point people to signals.py, and an import signals.py in __init__.py. I've seen beginners be trapped in the circular import loop when trying to move their signals to a separate file, not realizing that they also need to move the import of signals.py away from models to be able to use Model classes inside signals. -- You received this message because you are subscribed to the Google Groups "Django developers" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-developers/-/RA_A6SsBM-YJ. To post to this group, send email to django-developers@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.
Re: Thoughts on defining and autoimporting signals.py
On Thu, Dec 22, 2011 at 3:58 AM, Daniel Sokolowskiwrote: > Dear Django Developers, > > Is there any consensus on where to define your signals for models and > how to import them? I ask because to me it seems very odd that there > doesn't appear to be a standard way to add your own signals and have > them auto imported by the framework. I for example create a / > project_root/project_app/signals.py file and auto import it in the > __init__ of my project app. > > I have read and searched the > https://docs.djangoproject.com/en/dev/topics/signals/ > however it fails short to provide any gudiance on this. Yes - this is a known problem. The root problem is that there isn't a single reliable place to put "app startup" logic. With the current way Django handles apps, there isn't a single solution that will work everywhere, which one of the reasons that the docs are silent on the issue. The good news is that there is a plan to rectify this -- Arthur Koziel's App Refactor patch, largely created during the 2010 Google Summer of Code, and then polished by Jannis Leidel, provides a generic "entry point" for an app, which would be a suitable place to put logic such as signal registration. The bad news is that the patch has been languishing in need of review for a while. At this point, it almost certainly won't make 1.4; if it can get some attention, it would be a welcome addition to 1.5. Yours, Russ Magee %-) -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.
Re: Thoughts on defining and autoimporting signals.py
wrong list, you want django-users but yes, you are on the right track with importing from __init__, at least that's how i've always done it -- Brendan Smith IT Specialist National Priorities Project 243 King Street Suite 109 Northampton, MA 01060 http://nationalpriorities.org/ On Wednesday, December 21, 2011 at 2:58 PM, Daniel Sokolowski wrote: > Dear Django Developers, > > Is there any consensus on where to define your signals for models and > how to import them? I ask because to me it seems very odd that there > doesn't appear to be a standard way to add your own signals and have > them auto imported by the framework. I for example create a / > project_root/project_app/signals.py file and auto import it in the > __init__ of my project app. > > I have read and searched the > https://docs.djangoproject.com/en/dev/topics/signals/ > however it fails short to provide any gudiance on this. > > How do you do it, what are your thoughts on the making the auto import > and signals.py file standard? Has this been already discussed? > > -- > You received this message because you are subscribed to the Google Groups > "Django developers" group. > To post to this group, send email to django-developers@googlegroups.com > (mailto:django-developers@googlegroups.com). > To unsubscribe from this group, send email to > django-developers+unsubscr...@googlegroups.com > (mailto:django-developers+unsubscr...@googlegroups.com). > For more options, visit this group at > http://groups.google.com/group/django-developers?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.
Thoughts on defining and autoimporting signals.py
Dear Django Developers, Is there any consensus on where to define your signals for models and how to import them? I ask because to me it seems very odd that there doesn't appear to be a standard way to add your own signals and have them auto imported by the framework. I for example create a / project_root/project_app/signals.py file and auto import it in the __init__ of my project app. I have read and searched the https://docs.djangoproject.com/en/dev/topics/signals/ however it fails short to provide any gudiance on this. How do you do it, what are your thoughts on the making the auto import and signals.py file standard? Has this been already discussed? -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.