Author: leidel
Date: Mon Mar 30 13:25:32 2009
New Revision: 160

Modified:
    trunk/notification/engine.py

Log:
Fixed a finally statement for Python 2.4 compatibility

Modified: trunk/notification/engine.py
==============================================================================
--- trunk/notification/engine.py        (original)
+++ trunk/notification/engine.py        Mon Mar 30 13:25:32 2009
@@ -41,27 +41,29 @@
      start_time = time.time()

      try:
-        for queued_batch in NoticeQueueBatch.objects.all():
-            notices =  
pickle.loads(str(queued_batch.pickled_data).decode("base64"))
-            for user, label, extra_context, on_site in notices:
-                user = User.objects.get(pk=user)
-                logging.info("emitting notice to %s" % user)
-                # call this once per user to be atomic and allow for  
logging to
-                # accurately show how long each takes.
-                notification.send_now([user], label, extra_context,  
on_site)
-                sent += 1
-            queued_batch.delete()
-            batches += 1
-    except:
-        # get the exception
-        exc_class, e, t = sys.exc_info()
-        # email people
-        current_site = Site.objects.get_current()
-        subject = "[%s emit_notices] %r" % (current_site.name, e)
-        message = "%s" %  
("\n".join(traceback.format_exception(*sys.exc_info())),)
-        mail_admins(subject, message, fail_silently=True)
-        # log it as critical
-        logging.critical("an exception occurred: %r" % e)
+        # nesting the try statement to be Python 2.4
+        try:
+            for queued_batch in NoticeQueueBatch.objects.all():
+                notices =  
pickle.loads(str(queued_batch.pickled_data).decode("base64"))
+                for user, label, extra_context, on_site in notices:
+                    user = User.objects.get(pk=user)
+                    logging.info("emitting notice to %s" % user)
+                    # call this once per user to be atomic and allow for  
logging to
+                    # accurately show how long each takes.
+                    notification.send_now([user], label, extra_context,  
on_site)
+                    sent += 1
+                queued_batch.delete()
+                batches += 1
+        except:
+            # get the exception
+            exc_class, e, t = sys.exc_info()
+            # email people
+            current_site = Site.objects.get_current()
+            subject = "[%s emit_notices] %r" % (current_site.name, e)
+            message = "%s" %  
("\n".join(traceback.format_exception(*sys.exc_info())),)
+            mail_admins(subject, message, fail_silently=True)
+            # log it as critical
+            logging.critical("an exception occurred: %r" % e)
      finally:
          logging.debug("releasing lock...")
          lock.release()

--~--~---------~--~----~------------~-------~--~----~
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