Apache OpenOffice (AOO) Bugzilla – Issue 25309
ScriptProviderForPython argument handling is broken
Last modified: 2007-02-05 13:26:22 UTC
ScriptProviderForPython argument handling is broken as evidenced by the exception thrown by the pyuno bridge returning from calling invoke on the PythonScript component: Trace Message: ScriptProtocolHandler::dispatchWithNotificationn caught RuntimeException: pyuno bridge: expected for method invoke one return value and 1 out parameters, got a sequence of 3 elements as return value. The exception is coming from code in pyuno/source/module/pyuno_adapter.cxx around l. 264.
Retarget to OOo2.0.
Hiya Joerg, Can you take a look at this; I'm not much of a UNO or Python expert.
Hi, what version of OOo and Scripting Framework are you talking about ? Bye, Joerg
OOo 680m40. the Scripting framework is installed with OOo. You'll need to rebuild the Python provider library as it's missing a fix. replace "vnd.sun.star.script://" with "vnd.sun.star.script:" in pyprov.cxx & topbnode.cxx
Hi, it seems that I need to reimplement the whole binding between the scripting framework and pyuno. -> dfoster: Is there a documentation on the browsenodes somewhere, especially which properties a browsenode needs to support ? The SFArch.html does not say anything about it, but properties like URI, DESCRIPTION, EDITABLE, ... seem to be a must. Espescially the URI property is not clear to me at all, shall it be relative, absolute ? how to encode the scriptname, etc. Anything to read about the editable, creatable, etc., stuff ? Without these information, I can't continue. Bye, Joerg
The BrowseNode properties are mostly used by the UI code in the macro organiser (svx/source/dialog/scriptdlg.cxx) to control which buttons are enabled. They are also used by the script selector (svx/source/dialog/selector.cxx) to display a non-localised description of the script. the Java implementations of the XBrowseNode interface (found in scripting/java/com/sun/star/script/framework/browse) is a good reference implementation. Property: "Creatable" Type: Boolean Defined on: all nodes Description: defines whether a new node can be created as a child of this node. If this is true, then we expect to be able to get the XInvocation interface on the node, and call invoke with the functioname "Creatable" passing the name of the new childnode as the first argument, to create the new childnode. Property: "Deletable" Type: Boolean Defined on: all nodes Description: defines whether a the node can be deleted. If this is true, then we expect to be able to get the XInvocation interface on the node, and call invoke with the functioname "Deletable" to delete the node (and its childnodes). Property: "Renamable" Type: Boolean Defined on: all nodes Description: defines whether a the node can be renamed. If this is true, then we expect to be able to get the XInvocation interface on the node, and call invoke with the functioname "Renamable", passing the new name as the first arg to rename the node. Property: "Editable" Type: Boolean Defined on: on script nodes Description: defines whether a the script can be edited. If this is true, then we expect to be able to get the XInvocation interface on the node, and call invoke with the functioname "Editable" to launch the appropriate editor for the script. Property: "URI" Type: String Defined on: on script nodes Description: contains the script URI in the form: vnd.sun.star.script:[script_reference]?langauge=TheLanguage&location=[user|share|document] The script_reference is a textual reference to the script and is determined by the ScriptProviderForTheLangauge and has meaning for the ScriptProviderForTheLangauge only. It allows the ScriptProvider to map this reference to the "real" script. In the case of the LanuageScriptProviders for the java based languages the convention is Library.functionname where Library is the subdirectory under the language specific directory and functioname the functionname from the parcel-descriptor.xml in the "Library" directory. For packages the format is vnd.sun.star.script:[script_reference]?language=TheLanguage&location=[user:uno_package/packageName|share:uno_package/packageName] Property: "DESCRIPTION" (we should really rename this to be mixed case!) Type: String Defined on: on script nodes Description: contains a description of the script. Hope this helps!
Hi, thank you for the extensive documentation, however one thing leaves me puzzled: The scriptbrowsnode needs to export the uri property. vnd.sun.star.script:[script_reference]?langauge=TheLanguage&location=[user|share|document] But how shall the script know the location part ? During browsing, the initial LanguageScriptProvider just gets a url (currently a file url), how shall I know, whether the initial url points to user, share or document ? To me, it would make more sense, just to export the [script_reference] part, wouldn't it ? Bye, Joerg
Please see the code in scripting/java/com/sun/star/script/framework/container/ScriptMetaData.java and in particular the methods getShortFormScriptURL(), and getLocationPlaceHolder() for how we return the script URL.
Hi, sorry, but this wasn't much help. Resolving various levels of indirection, I found some important piece of code in ContainerCache.java if ( key instanceof XModel ) { XModel model = (XModel)key; result = new DocParcelContainer( expander, language ); } else if ( key instanceof String ) { key = expander.getMacroForValue( (String)key ); result = new ApplicationParcelContainer( (String)key, expander, language ); } , so I now know, how to differentiate between document and user/shared (is checking for XModel REALLY the desired way to do this ???), but I still did not understand, how to find differentiate user and shared. How is this done ? Bye, Joerg
The provider (see Scriptprovider.java) is initialised with a string context URL that tells it the location e.g. tdoc:// for documents user or well known vnd.sun.expand blah blah share or well known vnd.sun.expand blah blah We expose the whole uri as a propery for convience as clients e.g. the ui and framework code wants to use the uri not have to deal with forming it.
*** Issue 34374 has been marked as a duplicate of this issue. ***
Not sure I entirely understand this thread, but is there a workaround in 1.9.58 or other build that allows use of python macros? Also are there hints anywhere that suggest how to install macros etc? eagerly awaiting this feature... matt
*** Issue 38447 has been marked as a duplicate of this issue. ***
Hi, this issue is now fixed on cws pyunofixes1, should be qa'ed and integrated during the next weeks (hopefully before 2.0 beta, but I am not sure). I am going to create a documentation on how it can be used. Bye, Joerg
verified.
closed ancient issues