<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -135,6 +135,21 @@ Gatekeeper provides two methods of auto-moderation. First, if the user that save
 If the auto-moderation function returns None or is not specified for a model, the first form of auto-moderation will be attempted.
 
 
+Long Description
+----------------
+
+When registering a model, a long_desc parameter may be specified that is used to render descriptive text about the instance that is being moderated. The long description is used in emails and in the admin interface.
+
+	&gt;&gt;&gt; class Book(models.Model):
+	...     title = models.CharField(max_length=128)
+	...		author = models.CharField(max_length=128)
+	&gt;&gt;&gt; def booklongdesc(obj):
+	...     return u&quot;%s written by %s&quot; % (obj.title, obj.author)
+	&gt;&gt;&gt; gatekeeper.register(MyModel, long_desc=booklongdesc)
+
+The long_desc parameter accepts either a method or a string. If a method is passed, it will be invoked with the object as the only parameter. If a string is used, gatekeeper will first look on the object for a method with the same name, then an attribute if no method is found. If neither are found, or no long_desc parameter is specified, the objects __unicode__() method will be called.
+
+
 Default Moderation
 ------------------
 </diff>
      <filename>README.rst</filename>
    </modified>
    <modified>
      <diff>@@ -38,6 +38,15 @@ def _get_automod_user():
         automod_user.save()
         return automod_user
 
+def _long_desc(obj, long_desc):
+    if callable(long_desc):
+        return long_desc(obj)
+    attr = getattr(obj, long_desc, None)
+    if attr:
+        if callable(attr):
+            return attr(obj)
+        return unicode(attr)
+    return unicode(obj)
 
 #
 # register models with gatekeeper
@@ -46,6 +55,9 @@ def _get_automod_user():
 
 registered_models = {}
 
+def _default_long_desc(obj):
+    return unicode(obj)
+
 def register(model, import_unmoderated=False, auto_moderator=None, long_desc=None,
              manager_name='objects', status_name='moderation_status',
              flagged_name='flagged', moderation_object_name='moderation_object',
@@ -58,7 +70,7 @@ def register(model, import_unmoderated=False, auto_moderator=None, long_desc=Non
                    moderation_object_name, base_manager)
         registered_models[model] = {
             'auto_moderator': auto_moderator,
-            'long_desc': long_desc or lambda x: x.__unicode__(),
+            'long_desc': long_desc or _default_long_desc,
         }
         if import_unmoderated:
             try:
@@ -179,7 +191,7 @@ def save_handler(sender, **kwargs):
         mo.save()
 
         # do automoderation
-        auto_moderator = registered_models[instance.__class__]
+        auto_moderator = registered_models[instance.__class__]['auto_moderator']
         if auto_moderator:
             mod = auto_moderator(mo)
             if mod is None:
@@ -198,10 +210,25 @@ def save_handler(sender, **kwargs):
                     
         if MODERATOR_LIST:
             
+            from django.contrib.sites.models import Site
+            domain = Site.objects.get(id=settings.SITE_ID).domain
+            
+            status = mo.get_moderation_status_display()
+            instance_class = instance.__class__.__name__
             long_desc = registered_models[instance.__class__]['long_desc']
             
-            subject = &quot;[pending-moderation] %s&quot; % instance
-            message = &quot;New object pending moderation.\n%s\n%s&quot; % (long_desc(instance), reverse(&quot;gatekeeper_moderate_list&quot;))
+            # message
+            message = _long_desc(instance, long_desc)
+            if status == 'Pending':
+                message = &quot;%s\n\nTo moderate, go to http://%s%s&quot; % (message, domain, reverse(&quot;gatekeeper_moderate_list&quot;))
+            
+            # subject
+            key = &quot;%s:%s&quot; % (instance_class, status)
+            if mo.moderation_status_by and mo.moderation_status_by.username == 'gatekeeper_automod':
+                key = &quot;%s:auto&quot; % key
+            subject = &quot;[%s] New gatekeeper object on %s&quot; % (key, domain)
+            
+            # sender
             from_addr = settings.DEFAULT_FROM_EMAIL
             
             send_mail(subject, message, from_addr, MODERATOR_LIST, fail_silently=True)</diff>
      <filename>gatekeeper/__init__.py</filename>
    </modified>
    <modified>
      <diff>@@ -75,8 +75,8 @@ class ModeratedObject(models.Model):
         self.save()
         gatekeeper.post_flag.send(sender=ModeratedObject, instance=self)
 
-    def approve(self, user, reason=None):
+    def approve(self, user, reason=''):
         self._moderate(1, user, reason)
 
-    def reject(self, user, reason=None):
+    def reject(self, user, reason=''):
         self._moderate(-1, user, reason)</diff>
      <filename>gatekeeper/models.py</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>00d68a4cc61fac7a4b4504c8252310411abb880f</id>
    </parent>
  </parents>
  <author>
    <name>Jeremy Carbaugh</name>
    <email>jcarbaugh@gmail.com</email>
  </author>
  <url>http://github.com/sunlightlabs/django-gatekeeper/commit/b5acf1c5bfd4d766d9b89b1641987ec42587a8be</url>
  <id>b5acf1c5bfd4d766d9b89b1641987ec42587a8be</id>
  <committed-date>2009-08-27T14:05:43-07:00</committed-date>
  <authored-date>2009-08-27T14:05:43-07:00</authored-date>
  <message>add long_description and reformat emails</message>
  <tree>73ee8edfe678ed30e354c3cfc936c4701f111b93</tree>
  <committer>
    <name>Jeremy Carbaugh</name>
    <email>jcarbaugh@gmail.com</email>
  </committer>
</commit>
