Issue 25309 - ScriptProviderForPython argument handling is broken
Summary: ScriptProviderForPython argument handling is broken
Status: CLOSED FIXED
Alias: None
Product: General
Classification: Code
Component: scripting (show other issues)
Version: current
Hardware: All All
: P3 Trivial (vote)
Target Milestone: OOo 2.0
Assignee: joergbudi
QA Contact: issues@framework
URL:
Keywords:
: 34374 38447 (view as issue list)
Depends on:
Blocks:
 
Reported: 2004-02-10 09:47 UTC by duncan.foster
Modified: 2007-02-05 13:26 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description duncan.foster 2004-02-10 09:47:56 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.
Comment 1 duncan.foster 2004-02-10 09:48:38 UTC
Retarget to OOo2.0.
Comment 2 duncan.foster 2004-06-02 16:30:00 UTC
Hiya Joerg,
Can you take a look at this; I'm not much of a UNO or Python expert.
Comment 3 joergbudi 2004-06-02 20:46:27 UTC
Hi,

what version of OOo and Scripting Framework are you talking about ?

Bye, 

Joerg
Comment 4 duncan.foster 2004-06-03 09:31:55 UTC
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
Comment 5 joergbudi 2004-07-26 17:50:57 UTC
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
Comment 6 duncan.foster 2004-07-30 09:52:26 UTC
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!
Comment 7 joergbudi 2004-08-19 20:28:17 UTC
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 
Comment 8 duncan.foster 2004-09-07 10:18:25 UTC
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.
Comment 9 joergbudi 2004-09-14 20:10:02 UTC
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
Comment 10 duncan.foster 2004-09-28 10:24:26 UTC
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.
Comment 11 duncan.foster 2004-09-28 11:14:26 UTC
*** Issue 34374 has been marked as a duplicate of this issue. ***
Comment 12 moptop99 2004-11-10 17:36:20 UTC
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
Comment 13 joergbudi 2004-12-19 15:43:41 UTC
*** Issue 38447 has been marked as a duplicate of this issue. ***
Comment 14 joergbudi 2005-01-20 20:14:21 UTC
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
Comment 15 joerg.skottke 2005-02-03 13:39:14 UTC
verified.
Comment 16 Mathias_Bauer 2007-02-05 13:26:22 UTC
closed ancient issues