zotero / scaffold

Zotero translator creation IDE
http://www.zotero.org/support/dev/scaffold
38 stars 9 forks source link

dataMode ignored for Import translators #4

Closed aurimasv closed 12 years ago

aurimasv commented 12 years ago

Commit a32c7b6bf96a95141f9a54119cb0374833191b80 broke doImport and detectImport where data mode is set to rdf/xml. When attempting to import, I get error Zotero.RDF is undefined.

Scaffold creates it's own translator object, but does not set translator._sandboxManager.sandbox.ZOTERO_TRANSLATOR_INFO.configOptions before performing detectImport or doImport (https://github.com/zotero/scaffold/blob/master/chrome/content/scaffold/scaffold.js#L386)

Maybe Scaffold should load translators into sandbox?

simonster commented 12 years ago

The problem is that Scaffold puts 1 instead of the metadata JSON at the beginning of the code (https://github.com/zotero/scaffold/blob/master/chrome/content/scaffold/scaffold.js#L551). This was sufficient to fool translate.js before that change, but it's not anymore. (This hack means that the translator sets translator._sandboxManager.sandbox.ZOTERO_TRANSLATOR_INFO = 1, which obviously means that translator._sandboxManager.sandbox.ZOTERO_TRANSLATOR_INFO.configOptions doesn't do what it's supposed to do.)

aurimasv commented 12 years ago

So do you suggest we build the metadata object, convert to JSON and use that instead of 1. It's already being done for saving, so should be easy.

simonster commented 12 years ago

Yes, that's probably the best fix for this.