Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added comments to explain object encoding

git-svn-id: 590c3fc9-4838-0410-bb95-17a0c9b37ca9
  • Loading branch information...
commit 9c6a36a6906fe6f4591763720adb459817f2ec26 1 parent 139b7bf
@jtauber jtauber authored
Showing with 15 additions and 0 deletions.
  1. +15 −0 notification/
15 notification/
@@ -129,6 +129,21 @@ def create_notice_type(label, display, description):
NoticeType(label=label, display=display, description=description).save()
print "Created %s NoticeType" % label
+# a notice like "foo and bar are now friends" is stored in the database
+# as "{auth.User.5} and {auth.User.7} are now friends".
+# encode_object takes an object and turns it into "{}"
+# decode_object takes "{}" and turns it into the object
+# encode_message takes ("%s and %s are now friends", [foo, bar]) and turns
+# it into "{auth.User.5} and {auth.User.7} are now friends".
+# decode_message takes "{auth.User.5} and {auth.User.7}" and converts it
+# into a string using the given decode function to convert the object to
+# string representation
+# message_to_text and message_to_html use decode_message to produce a
+# text and html version of the message respectively.
def encode_object(obj):
return "{%s.%s.%s}" % (obj._meta.app_label, obj._meta.object_name,
Please sign in to comment.
Something went wrong with that request. Please try again.