Código fonte de google.appengine.api.datastore_errors
# Copyright 2007 Google Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Errors used in the Python datastore API."""
"""Base datastore error type.
"""Raised by Entity.__setitem__(), Query.__setitem__(), Get(), and others
when a property value or filter value is invalid.
"""Raised by Entity.__setitem__() when a property name isn't a string.
"""Raised by datastore calls when the parameter(s) are invalid.
"""DEPRECATED: Raised by Get() when the requested entity is not found.
"""Raised by Query.Order(), Iterator.Next(), and others when they're
passed an invalid argument.
"""DEPRECATED: Raised by Iterator methods when the Iterator is invalid. This
should not happen during normal usage; it protects against malicious users
and system errors.
"""DEPRECATED: Raised by RunInTransaction. This is an internal error; you
should not see this.
"""May be raised by transaction functions when they want to roll back
instead of committing. Note that *any* exception raised by a transaction
function will cause a rollback. This is purely for convenience. See
datastore.RunInTransaction for details.
"""Raised by RunInTransaction methods when the transaction could not be
committed, even after retrying. This is usually due to high contention.
"""Raised by Query.__setitem__() and Query.Run() when a filter string is
def __init__(self, filter):
self.filter = filter
message = (u'invalid filter: %s.' % self.filter).encode('utf-8')
"""Raised by Query when a query or query string is invalid.
"""Raised by Key.__str__ when the key is invalid.
"""An internal datastore error. Please report this to Google.
"""No matching index was found for a query that requires an index. Check
the Indexes page in the Admin Console and your index.yaml file.
def __init__(self, error, original_message=None, header=None, yaml_index=None,
self._original_message = original_message
self._header = header
self._yaml_index = yaml_index
self._xml_index = xml_index
[docs] def OriginalMessage(self):
[docs] def YamlIndex(self):
[docs] def XmlIndex(self):
return self._xml_index [docs]class ReferencePropertyResolveError(Error):
"""An error occurred while trying to resolve a ReferenceProperty."""
"""The datastore operation timed out, or the data was temporarily
unavailable. This can happen when you attempt to put, get, or delete too
many entities or an entity with too many properties, or if the datastore is
overloaded or having trouble.
"""The write or transaction was committed, but some entities or index rows
may not have been fully updated. Those updates should automatically be
applied soon. You can roll them forward immediately by reading one of the
entities inside a transaction.