Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Encode/decode pickle data before and coming out the database. pickle …

…doesn't gurantee a bytestream when done serializing.

git-svn-id: http://django-notification.googlecode.com/svn/trunk@107 590c3fc9-4838-0410-bb95-17a0c9b37ca9
  • Loading branch information...
commit b3d68f296811a874f5c219f31f972a70cf58a601 1 parent 151442c
@brosner brosner authored
Showing with 2 additions and 2 deletions.
  1. +1 −1  notification/engine.py
  2. +1 −1  notification/models.py
View
2  notification/engine.py
@@ -38,7 +38,7 @@ def send_all():
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)
View
2  notification/models.py
@@ -339,7 +339,7 @@ def queue(users, label, extra_context=None, on_site=True):
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):
Please sign in to comment.
Something went wrong with that request. Please try again.