[CalendarServer-changes] [10216] CalendarServer/branches/users/glyph/queue-locking-and-timing

source_changes at macosforge.org source_changes at macosforge.org
Fri Jan 4 16:38:25 PST 2013


Revision: 10216
          http://trac.calendarserver.org//changeset/10216
Author:   glyph at apple.com
Date:     2013-01-04 16:38:25 -0800 (Fri, 04 Jan 2013)
Log Message:
-----------
Add support for 'group by' to record.

Modified Paths:
--------------
    CalendarServer/branches/users/glyph/queue-locking-and-timing/twext/enterprise/dal/record.py

Property Changed:
----------------
    CalendarServer/branches/users/glyph/queue-locking-and-timing/

Modified: CalendarServer/branches/users/glyph/queue-locking-and-timing/twext/enterprise/dal/record.py
===================================================================
--- CalendarServer/branches/users/glyph/queue-locking-and-timing/twext/enterprise/dal/record.py	2013-01-05 00:38:24 UTC (rev 10215)
+++ CalendarServer/branches/users/glyph/queue-locking-and-timing/twext/enterprise/dal/record.py	2013-01-05 00:38:25 UTC (rev 10216)
@@ -282,7 +282,7 @@
 
 
     @classmethod
-    def query(cls, transaction, expr, order=None, ascending=True):
+    def query(cls, transaction, expr, order=None, ascending=True, group=None):
         """
         Query the table that corresponds to C{cls}, and return instances of
         C{cls} corresponding to the rows that are returned from that table.
@@ -297,10 +297,15 @@
 
         @param ascending: A boolean; if C{order} is not C{None}, whether to
             sort in ascending or descending order.
+
+        @param group: a L{ColumnSyntax} to group the resulting record objects
+            by.
         """
         kw = {}
         if order is not None:
             kw.update(OrderBy=order, Ascending=ascending)
+        if group is not None:
+            kw.update(GroupBy=group)
         return cls._rowsFromQuery(transaction, Select(list(cls.table),
                                                       From=cls.table,
                                                       Where=expr, **kw), None)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130104/c69d69fd/attachment-0001.html>


More information about the calendarserver-changes mailing list