It is not an unneeded write. You put a try-except around a db.put (a write) you want to do normally. But when the CapabilityDisabledError exception is raised you know the write failed because of Read-Only mode.
Just put your "... handle read-only ..." code at the place of "# fail gracefully here" and you don't need the extra RPC call. This RPC call CapabilitySet() is done every request. That increases respons time that is not needed. 2010/6/13 Darien Caldwell <[email protected]>: > I have seen from several sources that you can do this import: > > > from google.appengine.api.capabilities import CapabilitySet > > and then tell when the datastore is read-only like so: > > if not CapabilitySet('datastore_v3', > capabilities=['write']).is_enabled(): > ... handle read-only ... > > However this is the second time that maintenance has occured, and this > method didn't work. > > Is this now depreciated? Or did it ever work to begin with? > > I know this page shows a slightly different method, > http://code.google.com/appengine/docs/python/howto/maintenance.html > > But it requires that you try to write before discovering you'r'e in > read-only mode. I don't want to have to put in an un-needed write just > to find out if the Datastore is in Read-Only mode. > > Can anyone help with this? > > -- > You received this message because you are subscribed to the Google Groups > "Google App Engine" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/google-appengine?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.
