Google Drive API示例应用“DrEdit”javascript错误(Angular JS?)

时间:2022-11-14 23:17:17

I'm attempting to set up the sample application produced by Google called 'Dredit' for Python on Google App Engine. Documentation here: https://developers.google.com/drive/examples/python

我正在尝试在Google App Engine上设置由Google生成的名为“Dredit”的示例应用程序。这里的文档:https://developers.google.com/drive/examples/python

The application is supposed to be able to open, create, and edit files from the user's Google Drive folder.

该应用程序应该能够从用户的Google Drive文件夹中打开,创建和编辑文件。

Almost everything appears to be working, except for some JavaScript errors that appear in the console on the home page. Also, when I try to create a new document, I can't change the document's title, nor can I edit an existing document's name. However, it does allow me to edit the content of any document. To see for yourself, the app is here: http://www.dredit-python-0515.appspot.com. You'll need a Google Account to sign in.

除了主页控制台中出现的一些JavaScript错误外,几乎所有内容都可以正常工作。此外,当我尝试创建新文档时,我无法更改文档的标题,也无法编辑现有文档的名称。但是,它允许我编辑任何文档的内容。为了亲眼看看,该应用程序位于:http://www.dredit-python-0515.appspot.com。您需要一个Google帐户才能登录。

The errors are different in Chrome's JS console and Firebug, but they seem to center around the angularJS file in my project directory.

Chrome的JS控制台和Firebug中的错误不同,但它们似乎以我的项目目录中的angularJS文件为中心。

The error in Chrome is:

Chrome中的错误是:

TypeError: Cannot read property 'editable' of undefined

at Object.service.state (http://dredit-python-0515.appspot.com/js/services.js:135:37)

at http://dredit-python-0515.appspot.com/lib/angular-1.0.0/angular-1.0.0.js:6128:19

at OPERATORS.| (http://dredit-python-0515.appspot.com/lib/angular-1.0.0/angular-1.0.0.js:5560:74)

at http://dredit-python-0515.appspot.com/lib/angular-1.0.0/angular-1.0.0.js:5879:14

at Object.fn (http://dredit-python-0515.appspot.com/lib/angular-1.0.0/angular-1.0.0.js:4788:22)

at Object.Scope.$digest (http://dredit-python-0515.appspot.com/lib/angular-1.0.0/angular-1.0.0.js:7654:38)

at Object.Scope.$apply (http://dredit-python-0515.appspot.com/lib/angular-1.0.0/angular-1.0.0.js:7855:24)

at done (http://dredit-python-0515.appspot.com/lib/angular-1.0.0/angular-1.0.0.js:8844:20)

at completeRequest (http://dredit-python-0515.appspot.com/lib/angular-1.0.0/angular-1.0.0.js:8984:7)

at XMLHttpRequest.xhr.onreadystatechange (http://dredit-python-0515.appspot.com/lib/angular-1.0.0/angular-1.0.0.js:8954:11)

Any help is greatly appreciated!

任何帮助是极大的赞赏!

1 个解决方案

#1


1  

I can't get your app to work either, but looking at the stack trace:

我无法让你的应用程序工作,但查看堆栈跟踪:

The error is coming from the line

错误来自该行

} else if (!doc.info.editable) {
   return EditorState.READONLY;
}

in http://dredit-python-0515.appspot.com/js/services.js

在http://dredit-python-0515.appspot.com/js/services.js

When this code is called, doc.info is not defined.

调用此代码时,未定义doc.info。

For whatever reason, the "state" function is being called before the "createEditor" function which sets the doc.info object.

无论出于何种原因,在设置doc.info对象的“createEditor”函数之前调用“state”函数。

The easiest fix would be to replace the "else if" on line 135 with

最简单的解决方法是用第135行替换“else if”

} else if (doc.info && !doc.info.editable) {

#1


1  

I can't get your app to work either, but looking at the stack trace:

我无法让你的应用程序工作,但查看堆栈跟踪:

The error is coming from the line

错误来自该行

} else if (!doc.info.editable) {
   return EditorState.READONLY;
}

in http://dredit-python-0515.appspot.com/js/services.js

在http://dredit-python-0515.appspot.com/js/services.js

When this code is called, doc.info is not defined.

调用此代码时,未定义doc.info。

For whatever reason, the "state" function is being called before the "createEditor" function which sets the doc.info object.

无论出于何种原因,在设置doc.info对象的“createEditor”函数之前调用“state”函数。

The easiest fix would be to replace the "else if" on line 135 with

最简单的解决方法是用第135行替换“else if”

} else if (doc.info && !doc.info.editable) {