TypeError:'TransactionOptions'对象不可调用

时间:2012-09-22 20:51:21

标签: google-app-engine transactions google-cloud-datastore

    'TransactionOptions' object is not callable
Traceback (most recent call last):
  File "/base/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1511, in __call__
    rv = self.handle_exception(request, response, e)
  File "/base/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1505, in __call__
    rv = self.router.dispatch(request, response)
  File "/base/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1253, in default_dispatcher
    return route.handler_adapter(request, response)
  File "/base/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1077, in __call__
    return handler.dispatch()
  File "/base/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 547, in dispatch
    return self.handle_exception(e, self.app.debug)
  File "/base/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 545, in dispatch
    return method(*args, **kwargs)
  File "/base/data/home/apps/.../0-1.361943419475938372/cron.py", line 26, in get
    db.run_in_transaction(xg_on, transactional_task)
  File "/base/python27_runtime/python27_lib/versions/1/google/appengine/api/datastore.py", line 2433, in RunInTransaction
    return RunInTransactionOptions(None, function, *args, **kwargs)
  File "/base/python27_runtime/python27_lib/versions/1/google/appengine/api/datastore.py", line 2571, in RunInTransactionOptions
    ok, result = _DoOneTry(new_connection, function, args, kwargs)
  File "/base/python27_runtime/python27_lib/versions/1/google/appengine/api/datastore.py", line 2593, in _DoOneTry
    result = function(*args, **kwargs)
TypeError: 'TransactionOptions' object is not callable

我在cron.py中的代码如下:

def transactional_task():
    doStuff()
xg_on = db.create_transaction_options(xg=True)
db.run_in_transaction(xg_on, transactional_task)

直接从这里的文档中取消

为什么app引擎认为无法创建TransactionOptions?我的数据存储区是High Replication。

0 个答案:

没有答案