Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Encode/decode pickle data before and coming out the database. pickle …
…doesn't gurantee a bytestream when done serializing.

git-svn-id: https://django-notification.googlecode.com/svn/trunk@107 590c3fc9-4838-0410-bb95-17a0c9b37ca9
  • Loading branch information
brosner committed Oct 17, 2008
1 parent 0e4abd8 commit 7570991
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion notification/engine.py
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion notification/models.py
Expand Up @@ -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):

Expand Down

0 comments on commit 7570991

Please sign in to comment.