After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 641017 - Use json instead of yaml parser
Use json instead of yaml parser
Status: RESOLVED FIXED
Product: orca
Classification: Applications
Component: general
unspecified
Other All
: Normal normal
: 2.91.6
Assigned To: Javier Hernández
Orca Maintainers
Depends on:
Blocks:
 
 
Reported: 2011-01-31 10:50 UTC by Javier Hernández
Modified: 2011-02-23 12:24 UTC
See Also:
GNOME target: 3.0
GNOME version: ---


Attachments
patch1 (13.37 KB, patch)
2011-02-04 10:44 UTC, Javier Hernández
committed Details | Review
patch2 (1.22 KB, patch)
2011-02-04 10:44 UTC, Javier Hernández
committed Details | Review
patch3 (2.59 KB, patch)
2011-02-04 10:44 UTC, Javier Hernández
committed Details | Review
patch4 (1.38 KB, patch)
2011-02-07 09:52 UTC, Javier Hernández
committed Details | Review
This patch fixes json_backend test (2.22 KB, patch)
2011-02-23 12:13 UTC, Javier Hernández
committed Details | Review

Description Javier Hernández 2011-01-31 10:50:07 UTC
Gnome applications use json as a parser/reader, so it will be more gnome compliant if orca uses json instead of yaml.
Comment 1 Joanmarie Diggs (IRC: joanie) 2011-01-31 10:53:09 UTC
Marking at a blocker to GNOME 3 because yaml is not a blessed external dependency.
Comment 2 Javier Hernández 2011-01-31 10:54:29 UTC
I have done this task and pushed to my gitorious personal branch [1]

[1] http://gitorious.org/~jhernandez/orca-mirror/jhernandez-orca-mirror/commits/yaml-to-json
Comment 3 Javier Hernández 2011-02-04 10:44:03 UTC
Created attachment 180063 [details] [review]
patch1
Comment 4 Javier Hernández 2011-02-04 10:44:32 UTC
Created attachment 180064 [details] [review]
patch2
Comment 5 Javier Hernández 2011-02-04 10:44:52 UTC
Created attachment 180065 [details] [review]
patch3
Comment 6 Javier Hernández 2011-02-04 10:45:22 UTC
These three patches attached fixes this bug!
Comment 7 Joanmarie Diggs (IRC: joanie) 2011-02-05 07:21:17 UTC
(In reply to comment #6)
> These three patches attached fixes this bug!

Yay! Thanks Javi!! :-)

I suspect that we'll need to make some additional tweaks to the test harness (we did back when we switched to yaml), so I'll look at doing that. In the meantime, I noticed that if there are existing pre-json backend settings for Orca (i.e. the yaml settings which many of our users will have now), Orca doesn't start at all. Instead it presents the traceback below.

I think what might be more user-friendly is for us to catch this exception and place the user in the Orca preferences dialog automatically (i.e. like we would do if there were not any settings already established). Make sense?

Traceback (most recent call last):
  • File "<string>", line 1 in <module>
  • File "/usr/lib/python2.7/dist-packages/orca/orca.py", line 510 in <module>
    _settingsManager = SettingsManager()
  • File "/usr/lib/python2.7/dist-packages/orca/settings_manager.py", line 106 in __init__
    if not self.isFirstStart():
  • File "/usr/lib/python2.7/dist-packages/orca/settings_manager.py", line 446 in isFirstStart
    return self._backend.isFirstStart()
  • File "/usr/lib/python2.7/dist-packages/orca/backends/json_backend.py", line 132 in isFirstStart
    self._getSettings()
  • File "/usr/lib/python2.7/dist-packages/orca/backends/json_backend.py", line 88 in _getSettings
    prefs = load(settingsFile)
  • File "/usr/lib/python2.7/json/__init__.py", line 278 in load
    **kw)
  • File "/usr/lib/python2.7/json/__init__.py", line 326 in loads
    return _default_decoder.decode(s)
  • File "/usr/lib/python2.7/json/decoder.py", line 360 in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  • File "/usr/lib/python2.7/json/decoder.py", line 378 in raw_decode
    raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded

Comment 8 Javier Hernández 2011-02-05 19:11:40 UTC
(In reply to comment #7)
> (In reply to comment #6)
> > These three patches attached fixes this bug!
> 
> Yay! Thanks Javi!! :-)

Thanks to you for testing! ;)


> 
> I suspect that we'll need to make some additional tweaks to the test harness
> (we did back when we switched to yaml), so I'll look at doing that.

This is not necessary since i did it, so go and check the third patch I attached! ;)

 In the
> meantime, I noticed that if there are existing pre-json backend settings for
> Orca (i.e. the yaml settings which many of our users will have now), Orca
> doesn't start at all. Instead it presents the traceback below.
> 
> I think what might be more user-friendly is for us to catch this exception and
> place the user in the Orca preferences dialog automatically (i.e. like we would
> do if there were not any settings already established). Make sense?

Of course, let's present Orca preferences dialog, so i'll take a look.

If you're working on this right now, please let me know!


> 
> Traceback (most recent call last):
> 

Regards!
Comment 9 Joanmarie Diggs (IRC: joanie) 2011-02-05 22:23:02 UTC
(In reply to comment #8)

> > I suspect that we'll need to make some additional tweaks to the test harness
> > (we did back when we switched to yaml), so I'll look at doing that.
> 
> This is not necessary since i did it, so go and check the third patch I
> attached! ;)

I read all of the patches before I tried them and commented. ;-)

So there's that one little settings test, and there's about 5 hours worth of Orca regression tests. The latter depend upon Orca settings just like using Orca does. Did you run any of those tests? I mean, I would think that things like this will need to be replaced:
http://git.gnome.org/browse/orca/tree/test/harness/user-settings.conf.in
http://git.gnome.org/browse/orca/tree/test/keystrokes/gtk-demo/spoken_indentation.settings
http://git.gnome.org/browse/orca/tree/test/keystrokes/firefox/sayAll_bug-591351-1.settings

The first one uses the default settings. The second and third each have one or two settings which are different.

Would you like to also update those, or shall I?
Comment 10 Joanmarie Diggs (IRC: joanie) 2011-02-05 22:32:48 UTC
Actually, correction: The first one doesn't use the default settings either; it uses those settings required to run the test harness as expected. ;-)
Comment 11 Javier Hernández 2011-02-05 23:20:03 UTC
(In reply to comment #9)
> (In reply to comment #8)
> 
> > > I suspect that we'll need to make some additional tweaks to the test harness
> > > (we did back when we switched to yaml), so I'll look at doing that.
> > 
> > This is not necessary since i did it, so go and check the third patch I
> > attached! ;)
> 
> I read all of the patches before I tried them and commented. ;-)

I didn't want to say the opposite! :P

> 
> So there's that one little settings test, and there's about 5 hours worth of
> Orca regression tests. The latter depend upon Orca settings just like using
> Orca does. Did you run any of those tests? I mean, I would think that things
> like this will need to be replaced:
> http://git.gnome.org/browse/orca/tree/test/harness/user-settings.conf.in
> http://git.gnome.org/browse/orca/tree/test/keystrokes/gtk-demo/spoken_indentation.settings
> http://git.gnome.org/browse/orca/tree/test/keystrokes/firefox/sayAll_bug-591351-1.settings
> 
> The first one uses the default settings. The second and third each have one or
> two settings which are differen

Sorry Joanie, I didn't realize all these stuff 

> 
> Would you like to also update those, or shall I?


I think you're the best here! ;)

Regards!
Comment 12 Joanmarie Diggs (IRC: joanie) 2011-02-06 00:28:43 UTC
(In reply to comment #11)

> > Would you like to also update those, or shall I?
> 
> 
> I think you're the best here! ;)

Way to get yourself out of learning about our testing harness. :-P :-P

Actually, I'm happy to do it. Are you going to tackle the issue regarding Orca not starting if the yaml prefs are present? If so, I'll wait for that patch, update the harness, and then run all the tests as a final sanity check.
Comment 13 Javier Hernández 2011-02-06 04:42:02 UTC
(In reply to comment #12)
> (In reply to comment #11)
> 
> > > Would you like to also update those, or shall I?
> > 
> > 
> > I think you're the best here! ;)
> 
> Way to get yourself out of learning about our testing harness. :-P :-P
> 

Yup, better.... xD

> Actually, I'm happy to do it. Are you going to tackle the issue regarding Orca
> not starting if the yaml prefs are present? 

Of course, five mins patch .. ;)

If so, I'll wait for that patch,
> update the harness, and then run all the tests as a final sanity check.

Cheers!  :]
Comment 14 Javier Hernández 2011-02-07 09:52:56 UTC
Created attachment 180276 [details] [review]
patch4

Here's the patch

Now, if json.load raises a ValueError exception, it is catched and we present orca preferences dialog as in a firstStart
Comment 19 Joanmarie Diggs (IRC: joanie) 2011-02-08 03:56:12 UTC
Updated regression files as expected.
http://git.gnome.org/browse/orca/commit/?id=13552b6e7401431443ef58065d25349dc748a59a
Comment 20 Javier Hernández 2011-02-23 12:13:54 UTC
Created attachment 181688 [details] [review]
This patch fixes json_backend test
Comment 21 Joanmarie Diggs (IRC: joanie) 2011-02-23 12:24:13 UTC
Comment on attachment 181688 [details] [review]
This patch fixes json_backend test

http://git.gnome.org/browse/orca/commit/?id=411e2e9ff9c47d503df95c989f89a41a37dd190b