patches = context.filters.apply(patches)
if not editable_order:
- patches = patches.order_by(order.query())
+ patches = order.apply(patches)
+
+ # we don't need the content or headers for a list; they're text fields
+ # that can potentially contain a lot of data
+ patches = patches.defer('content', 'headers')
+
+ # but we will need to follow the state and submitter relations for
+ # rendering the list template
+ patches = patches.select_related('state', 'submitter')
paginator = Paginator(request, patches)
if len(parts) == 2:
(body, postscript) = parts
body = body.strip() + "\n"
- postscript = postscript.strip() + "\n"
+ postscript = postscript.rstrip()
else:
postscript = ''
.exclude(msgid = patch.msgid):
body += comment.patch_responses()
- if body:
- body += '\n'
-
if postscript:
- body += '---\n' + postscript.strip() + '\n'
+ body += '---\n' + postscript + '\n'
if patch.content:
body += '\n' + patch.content
- utc_timestamp = (patch.date -
- datetime.datetime.utcfromtimestamp(0)).total_seconds()
+ delta = patch.date - datetime.datetime.utcfromtimestamp(0)
+ utc_timestamp = delta.seconds + delta.days*24*3600
mail = PatchMbox(body)
mail['Subject'] = patch.name