[CalendarServer-changes] [9655] CalendarServer/branches/users/glyph/q
source_changes at macosforge.org
source_changes at macosforge.org
Sat Aug 11 01:55:27 PDT 2012
Revision: 9655
http://trac.macosforge.org/projects/calendarserver/changeset/9655
Author: glyph at apple.com
Date: 2012-08-11 01:55:27 -0700 (Sat, 11 Aug 2012)
Log Message:
-----------
better docs
Modified Paths:
--------------
CalendarServer/branches/users/glyph/q/twext/enterprise/dal/record.py
Property Changed:
----------------
CalendarServer/branches/users/glyph/q/
Modified: CalendarServer/branches/users/glyph/q/twext/enterprise/dal/record.py
===================================================================
--- CalendarServer/branches/users/glyph/q/twext/enterprise/dal/record.py 2012-08-11 08:55:26 UTC (rev 9654)
+++ CalendarServer/branches/users/glyph/q/twext/enterprise/dal/record.py 2012-08-11 08:55:27 UTC (rev 9655)
@@ -23,10 +23,10 @@
"""
from twisted.internet.defer import inlineCallbacks, returnValue
-from twext.enterprise.dal.syntax import Select, Tuple, Constant, ColumnSyntax
-from twext.enterprise.dal.syntax import Insert
-from twext.enterprise.dal.syntax import Update
-from twext.enterprise.dal.syntax import Delete
+from twext.enterprise.dal.syntax import (
+ Select, Tuple, Constant, ColumnSyntax, Insert, Update, Delete
+)
+# from twext.enterprise.dal.syntax import ExpressionSyntax
class ReadOnly(AttributeError):
"""
@@ -176,6 +176,17 @@
"""
Query the table that corresponds to C{cls}, and return instances of
C{cls} corresponding to the rows that are returned from that table.
+
+ @param expr: An L{ExpressionSyntax} that constraints the results of the
+ query. This is most easily produced by accessing attributes on the
+ class; for example, C{MyRecordType.query((MyRecordType.col1 >
+ MyRecordType.col2).And(MyRecordType.col3 == 7))}
+
+ @param order: A L{ColumnSyntax} to order the resulting record objects
+ by.
+
+ @param ascending: A boolean; if C{order} is not C{None}, whether to
+ sort in ascending or descending order.
"""
kw = {}
if order is not None:
@@ -188,6 +199,20 @@
@classmethod
@inlineCallbacks
def _rowsFromQuery(cls, txn, qry, rozrc):
+ """
+ Execute the given query, and transform its results into rows.
+
+ @param txn: an L{IAsyncTransaction} to execute the query on.
+
+ @param qry: a L{_DMLStatement} (XXX: maybe _DMLStatement or some
+ interface that defines 'on' should be public?) whose results are
+ the list of columns in C{self.__tbl__}.
+
+ @param rozrc: The C{raiseOnZeroRowCount} argument.
+
+ @return: a L{Deferred} that succeeds with a C{list} or fails with an
+ exception produced by C{rozrc}.
+ """
rows = yield qry.on(txn, raiseOnZeroRowCount=rozrc)
selves = []
for row in rows:
@@ -227,4 +252,5 @@
__all__ = [
"ReadOnly",
"fromTable",
-]
\ No newline at end of file
+ "NoSuchRecord",
+]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120811/e969b0df/attachment.html>
More information about the calendarserver-changes
mailing list