Author: brosner
Date: Sun Sep 28 22:10:08 2008
New Revision: 981

Modified:
    trunk/local_apps/account/forms.py
    trunk/local_apps/core/utils.py

Log:
Changed the way we get send_mail to use INSTALLED_APPS in accounts.

Modified: trunk/local_apps/account/forms.py
==============================================================================
--- trunk/local_apps/account/forms.py   (original)
+++ trunk/local_apps/account/forms.py   Sun Sep 28 22:10:08 2008
@@ -7,11 +7,8 @@
  from django.utils.translation import ugettext_lazy as _, ugettext
  from django.utils.encoding import smart_unicode

-# favour django-mailer but fall back to django.core.mail
-try:
-    from mailer import send_mail
-except ImportError:
-    from django.core.mail import send_mail
+from core.utils import get_send_mail
+send_mail = get_send_mail()

  from django.contrib.auth import authenticate, login
  from django.contrib.auth.models import User

Modified: trunk/local_apps/core/utils.py
==============================================================================
--- trunk/local_apps/core/utils.py      (original)
+++ trunk/local_apps/core/utils.py      Sun Sep 28 22:10:08 2008
@@ -20,3 +20,19 @@
              sources.append(func)
          _inbox_count_sources = tuple(sources)
      return _inbox_count_sources
+
+
+def get_send_mail():
+    """
+    A function to return a send_mail function suitable for use in the app.  
It
+    deals with incompatibilities between signatures.
+    """
+    # favour django-mailer but fall back to django.core.mail
+    if "mailer" in settings.INSTALLED_APPS:
+        from mailer import send_mail
+    else:
+        from django.core.mail import send_mail as _send_mail
+        def send_mail(*args, **kwargs):
+            del kwargs["priority"]
+            return _send_mail(*args, **kwargs)
+    return send_mail

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pinax-updates" 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/pinax-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to