PyUNO ConfigurationUpdateAccess does not serialize configuration
Stephan Bergmann
sbergman at redhat.com
Wed Apr 25 02:38:51 PDT 2012
On 04/24/2012 10:40 PM, Jordi Llonch wrote:
> I am trying to add a new path into AutoText Paths configuration using PyUNO.
>
> By executing the following code, AutoText UserPaths shows the added path
> but changes
> are not set to LibreOffice configuration.
>
> What I am doing wrong?
Trying this with latest LO master (on Fedora 16, not Mac OS X, but that
should hardly make a difference here I'd assume), it does work fine for
me (and correctly saves the new UserPaths value in
registrymodifications.xcu). However, I had to make two changes to the
Python script (attached):
* desktop and config need to be obtained via the remote service manager,
not the local one. (The behaviour of S.createInstanceWithContext(D, C)
apparently changed with my recent rewrite of the default service
manager. Now, D is always instantiated relative to S, regardless of the
given C -- the latter is only passed on to the instantiated service. In
the past, it appears that D was instantiated relative to C's service
manager instead of the given S -- which looks kinda broken, given you
explicitly ask S to create an instance.) Surely a gotcha to watch out
for...
* If the AutoText UserPaths property does not yet have a value, reading
its value returns None instead of () (as the property is implicitly
nillable). That makes "autotext_path.UserPaths + (path,)" fail.
Stephan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.py
Type: text/x-python
Size: 1427 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20120425/864fcba5/attachment-0001.py>
More information about the LibreOffice
mailing list