<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -110,10 +110,15 @@ class GQLQueryBuilder:
           if name == 'type': continue # TO-DO: make it so that you don't have to do this
           self.gql_query += [selector.leftside, selector.operator, selector.rightside_raw]
   def process_ordering_conditions(self):
-    if self.content != None: # TO-DO: from, to
-      order = self.ordering.get('order', None)
-      if order != None:
-        self.gql_query += ['ORDER BY', order.field, order.order]
+    order = self.ordering.get('order', None)
+    if order != None:
+      self.gql_query += ['ORDER BY', order.field, order.order]
+    _from = self.ordering.get('from', None)
+    _to = self.ordering.get('to', None)
+    if _from != None and _to != None:
+      _from, _to = int(_from.rightside), int(_to.rightside)
+      self.gql_query += ['LIMIT', '%s, %s' % (int(_from), (_to-_from))]
+
   def __str__(self):
     return ' '.join(self.gql_query)
 
@@ -122,7 +127,7 @@ class XNQueryTester(unittest.TestCase):
     (&quot;profile(id='david')&quot;, None),
     (&quot;content(type='User'&amp;author='david')&quot;, None),
     (&quot;content&quot;, &quot;order=published@D&quot;),
-    (&quot;content(type='Photo')&quot;, &quot;order=my.viewCount@D&amp;from=0&amp;to=10&quot;),
+    (&quot;content(type='Photo')&quot;, &quot;order=my.viewCount@D&amp;from=20&amp;to=30&quot;),
     (&quot;content(type='Topic'&amp;my.xg_forum_commentCount&gt;1)&quot;, &quot;order=my.xg_forum_commentCount@D&amp;from=0&amp;to=5&quot;)
   )
   def test_author_is_david(self):
@@ -144,12 +149,12 @@ class XNQueryTester(unittest.TestCase):
     sample_query = self.queries[3]
     xnquery = XNQueryParser(sample_query[0], sample_query[1])
     gqlquery = GQLQueryBuilder(xnquery)
-    assert str(gqlquery) == &quot;&quot;&quot;SELECT * FROM Photo ORDER BY viewCount DESC&quot;&quot;&quot;
+    assert str(gqlquery) == &quot;&quot;&quot;SELECT * FROM Photo ORDER BY viewCount DESC LIMIT 20, 10&quot;&quot;&quot;
 
 if __name__ == '__main__':
   unittest.main()
   # helpful for debugging
-  # sample_query = (&quot;content(type='Photo')&quot;, &quot;order=my.viewCount@D&amp;from=0&amp;to=10&quot;)
+  # sample_query = (&quot;content(type='Photo')&quot;, &quot;order=my.viewCount@D&amp;from=20&amp;to=30&quot;)
   # xnquery = XNQueryParser(sample_query[0], sample_query[1])
   # gqlquery = GQLQueryBuilder(xnquery)
   # print str(gqlquery)
\ No newline at end of file</diff>
      <filename>xnquery.py</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>11373208ea9af1dd0023206c1c3d15a9ebe59596</id>
    </parent>
  </parents>
  <author>
    <name>Jonas Galvez</name>
    <email>jonas@codeazur.com.br</email>
  </author>
  <url>http://github.com/fczuardi/gae-rest/commit/219c9aa7516fc842ed5e56ceed0322c9a5c36632</url>
  <id>219c9aa7516fc842ed5e56ceed0322c9a5c36632</id>
  <committed-date>2008-06-26T08:45:47-07:00</committed-date>
  <authored-date>2008-06-26T08:45:47-07:00</authored-date>
  <message>Added pagination support.</message>
  <tree>7d5244c4ccd956a4d37e36f88a6cc945eb7ff269</tree>
  <committer>
    <name>Jonas Galvez</name>
    <email>jonas@codeazur.com.br</email>
  </committer>
</commit>
