def safe_call(func):
    """
    Causes the decorated function to reraise GAE datastore errors as
    Django DatabaseErrors.
    """

    @wraps(func)
    def _func(*args, **kwargs):
        try:
            return func(*args, **kwargs)
        except GAEError, e:
            raise DatabaseError, DatabaseError(str(e)), sys.exc_info()[2]
    return _func