<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,3 +1,4 @@
 *.pyc
 .DS_Store
 .emacs.*
+.#*</diff>
      <filename>.gitignore</filename>
    </modified>
    <modified>
      <diff>@@ -2262,9 +2262,9 @@ class EnsureReminderTimesHandler(GoHandler):
         try:
             # get our request data
             try:
-                last_key_seen = self.request.get('last_key_seen')
+                last_id_seen = int(self.request.get('last_id_seen'))                
             except:
-                last_key_seen = None
+                last_id_seen = 0
 
             try:
                 amount = int(self.request.get('amount'))
@@ -2272,29 +2272,27 @@ class EnsureReminderTimesHandler(GoHandler):
                 amount = 10
 
             # get some games -- if a key is specified, start there.
-            if (last_key_seen is None) or len(last_key_seen) &lt; 1:
+            if last_id_seen == 0:
                 query = db.GqlQuery('SELECT * from Game ORDER BY __key__')
                 games = query.fetch(amount)
             else:
-                last_entity = Game.get_by_key_name(last_key_seen)
-                last_key = last_entity.key()
-                query = db.GqlQuery('SELECT * from Game WHERE __key__ &gt; :1 ORDER BY __key__', last_key)
+                last_key_seen = db.Key.from_path('Game', last_id_seen)
+                query = db.GqlQuery('SELECT * from Game WHERE __key__ &gt; :1 ORDER BY __key__', last_key_seen)
                 games = query.fetch(amount)
 
             # sanity check
             if games is None:
-                self.render_json({'success': True, 'amount_found': 0, 'amount_modified': 0, 'new_last_key': ''})
+                self.render_json({'success': True, 'amount_found': 0, 'amount_modified': 0, 'new_last_id': -1})
             else:
                 # figure out what the next key will be -- we've got to do
                 # this stuff in batches, after all
                 amount_found = len(games)
                 if amount_found &lt; 1:
                     last_item = None
-                    new_last_key = &quot;&quot;
+                    new_last_id = -1
                 else:
-                    logging.info(repr(games))
                     last_item = games[-1]
-                    new_last_key = last_item.key().name()
+                    new_last_id = int(last_item.key().id())
 
                 # batch up any games that are missing a key
                 games_to_write = []
@@ -2316,20 +2314,17 @@ class EnsureReminderTimesHandler(GoHandler):
                         db.put(games_to_write)
                     except:
                         db.put(games_to_write)
-
-                logging.info(&quot;AMOUNT FOUND: %d; AMOUNT MODIFIED: %d&quot; % (amount_found, len(games_to_write)))
-                logging.info(&quot;new last key: %s&quot; % new_last_key)
                 
-                self.render_json({'success': True, 'amount_found': amount_found, 'amount_modified': len(games_to_write), 'new_last_key': new_last_key})
+                self.render_json({'success': True, 'amount_found': amount_found, 'amount_modified': len(games_to_write), 'new_last_id': new_last_id})
         except:
-            self.render_json({'success': False, 'Error': ExceptionHelper.exception_string(), 'game_count': game_count})
-
+            self.render_json({'success': False, 'Error': ExceptionHelper.exception_string(), 'game_count': 0})
             
 class UpdateDatabaseHandler(GoHandler):
     def __init__(self):
         super(UpdateDatabaseHandler, self).__init__()
 
     def get(self, *args):
+        self.response.headers['Content-Type'] = &quot;text/plain&quot;
         self.render_template(&quot;update-database.html&quot;, {})
             
 class SendRemindersHandler(GoHandler):
@@ -2377,7 +2372,8 @@ class SendRemindersHandler(GoHandler):
             self.render_json_as_text({'success': False, 'Error': ExceptionHelper.exception_string(), 'message': message})
         else:
             self.render_json_as_text({'success': True, 'message': message})
-        
+
+            
 #------------------------------------------------------------------------------
 # Main WebApp Code
 #------------------------------------------------------------------------------</diff>
      <filename>go.py</filename>
    </modified>
    <modified>
      <diff>@@ -2622,15 +2622,15 @@ var DatabaseUpdateController = Class.create({
         this._inner_ensure_reminder_times(null, 5);
     },
 
-    _inner_ensure_reminder_times : function(last_key_seen, amount)
+    _inner_ensure_reminder_times : function(last_id_seen, amount)
     {
         var self = this;
 
         var parameters = {};
         parameters[&quot;amount&quot;] = amount.toString();
-        if (last_key_seen != null)
+        if (last_id_seen != null)
         {
-            parameters[&quot;last_key_seen&quot;] = last_key_seen;
+            parameters[&quot;last_id_seen&quot;] = last_id_seen.toString();
         }
                 
         new Ajax.Request
@@ -2638,13 +2638,14 @@ var DatabaseUpdateController = Class.create({
             &quot;/cron/ensure-reminder-times/&quot;,
             {
                 method: 'POST',
+                parameters: parameters,
                 
                 onSuccess: function(result)
                 {
                     var json = eval_json(result.responseText);
                     if (json['success'])
                     {
-                        self._handle_ensure_url_response(amount, json['amount_found'], json['amount_modified'], json['new_last_key']);
+                        self._handle_ensure_url_response(amount, json['amount_found'], json['amount_modified'], json['new_last_id']);
                     }
                     else
                     {
@@ -2662,14 +2663,14 @@ var DatabaseUpdateController = Class.create({
         );
     },
 
-    _handle_ensure_url_response : function(amount, amount_found, amount_modified, new_last_key)
+    _handle_ensure_url_response : function(amount, amount_found, amount_modified, new_last_id)
     {
         this.total_found += amount_found;
         this.total_modified += amount_modified;
         if (amount_found &gt; 0)
         {
             $(&quot;updating&quot;).innerHTML = &quot;UPDATING: Modified &quot; + this.total_modified.toString() + &quot; out of &quot; + this.total_found.toString() + &quot;.&quot;;
-            this._inner_ensure_reminder_times(new_last_key, amount);            
+            this._inner_ensure_reminder_times(new_last_id, amount);            
         }
         else
         {</diff>
      <filename>static/js/go.js</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>94de8725f53f956b4c707fd5582bf1f6bf87b9c4</id>
    </parent>
  </parents>
  <author>
    <name>Dave Peck</name>
    <email>c-github@delver.org</email>
  </author>
  <url>http://github.com/davepeck/appengine-go/commit/fc3c2665af0f281ddd65b8c1d026e46d336f99b9</url>
  <id>fc3c2665af0f281ddd65b8c1d026e46d336f99b9</id>
  <committed-date>2009-05-11T15:21:56-07:00</committed-date>
  <authored-date>2009-05-11T15:21:56-07:00</authored-date>
  <message>Fix reminder bugs; use Key.from_path() to generate a Key based on an ID rather than trying to ORDER BY __id__</message>
  <tree>3a1cb0e8d393721f1aaf34f3a2f298ab878d1d58</tree>
  <committer>
    <name>Dave Peck</name>
    <email>c-github@delver.org</email>
  </committer>
</commit>
