#8399: loaddata management command should provide option to disable signals
--------------------------------------------+-------------------------------
          Reporter:  chrisdpr...@gmail.com  |         Owner:  nobody
            Status:  new                    |     Milestone:        
         Component:  django-admin.py        |       Version:  SVN   
        Resolution:                         |      Keywords:        
             Stage:  Accepted               |     Has_patch:  0     
        Needs_docs:  0                      |   Needs_tests:  0     
Needs_better_patch:  0                      |  
--------------------------------------------+-------------------------------
Comment (by gsong):

 How about just a simple decorator for signal_handlers?

 Something like:
 {{{
 #!python
 try:
     from functools import wraps
 except ImportError:
     from django.utils.functional import wraps

 import inspect


 def noop_handler(*args, **kwargs):
     pass


 def disable_for_loaddata(signal_handler):
     for fr in inspect.stack():
         if inspect.getmodulename(fr[1]) == 'django-admin':
             return wraps(signal_handler)(noop_handler)
     return signal_handler
 }}}

-- 
Ticket URL: <http://code.djangoproject.com/ticket/8399#comment:4>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

--

You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.


Reply via email to