Author: brosner
Date: Fri Oct 17 13:31:28 2008
New Revision: 107

Modified:
    trunk/notification/engine.py
    trunk/notification/models.py

Log:
Encode/decode pickle data before and coming out the database. pickle  
doesn't gurantee a bytestream when done serializing.

Modified: trunk/notification/engine.py
==============================================================================
--- trunk/notification/engine.py        (original)
+++ trunk/notification/engine.py        Fri Oct 17 13:31:28 2008
@@ -38,7 +38,7 @@

      try:
          for queued_batch in NoticeQueueBatch.objects.all():
-            notices = pickle.loads(str(queued_batch.pickled_data))
+            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)

Modified: trunk/notification/models.py
==============================================================================
--- trunk/notification/models.py        (original)
+++ trunk/notification/models.py        Fri Oct 17 13:31:28 2008
@@ -339,7 +339,7 @@
      notices = []
      for user in users:
          notices.append((user, label, extra_context, on_site))
-    NoticeQueueBatch(pickled_data=pickle.dumps(notices)).save()
+     
NoticeQueueBatch(pickled_data=pickle.dumps(notices).encode("base64")).save()

  class ObservedItemManager(models.Manager):


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