Hi mvo, thanks for this! I think it's a good idea to consolidate the UUID stuff more, however, there are two reasons why I left the connection to app.py (with the signal). The first is because I planned to add an opt-out menu item (which will be a dead-simple change). The second is that I thought it best to keep all of the code that writes to the main config file in one place, that is, in app.py. Else somebody else will have to search if they want to explain where this mysterious other field is coming from in the main config file.
In any case, I am seeing two problems with it the current branch. One is a failure in the unit test, the other occurs when running the app itself (specifically, soemthing that would occur during a first run in a new install, further details below).
First, the unit test:
======================================================================
ERROR: test_mocked_recagent_post_submit_profile (__main__.TestRecommenderAgent)
----------------------------------------------------------------------
Traceback (most recent call last):
File "test_recagent.py", line 48, in test_mocked_recagent_post_submit_profile
recommender_agent.post_submit_profile(db)
File "/home/tremolux/Projects/precise/software-center_review_mvo_recommender_uuid_consolidation/software-center/softwarecenter/backend/recagent.py", line 98, in post_submit_profile
self.recommender_uuid = get_uuid()
File "/home/tremolux/Projects/precise/software-center_review_mvo_recommender_uuid_consolidation/software-center/softwarecenter/backend/recagent.py", line 236, in _set_recommender_uuid
config.set("general", "recommender_uuid", self.recommender_uuid)
File "/usr/lib/python2.7/ConfigParser.py", line 753, in set
ConfigParser.set(self, section, option, value)
File "/usr/lib/python2.7/ConfigParser.py", line 396, in set
raise NoSectionError(section)
NoSectionError: No section: 'general'
----------------------------------------------------------------------
Ran 7 tests in 6.296s
FAILED (failures=1, errors=1)
---
And the failure with the app itself occurs in the case where we have not yet made the cfg file (you can see this with a 'rm .config/software-center/softwarecenter.cfg'). This would happen on first run of software-center for a new install, for instance, and if the user opt-in to recommendations then. What happens in the UI is that the "Uploading user profile" spinner hangs.
Traceback (most recent call last):
File "/home/tremolux/Projects/precise/software-center_review_mvo_recommender_uuid_consolidation/software-center/softwarecenter/ui/gtk3/widgets/recommendations.py", line 127, in _on_opt_in_button_clicked
self._upload_user_profile_and_get_recommendations()
File "/home/tremolux/Projects/precise/software-center_review_mvo_recommender_uuid_consolidation/software-center/softwarecenter/ui/gtk3/widgets/recommendations.py", line 131, in _upload_user_profile_and_get_recommendations
self._upload_user_profile()
File "/home/tremolux/Projects/precise/software-center_review_mvo_recommender_uuid_consolidation/software-center/softwarecenter/ui/gtk3/widgets/recommendations.py", line 139, in _upload_user_profile
self.recommender_agent.post_submit_profile(self.catview.db)
File "/home/tremolux/Projects/precise/software-center_review_mvo_recommender_uuid_consolidation/software-center/softwarecenter/backend/recagent.py", line 98, in post_submit_profile
self.recommender_uuid = get_uuid()
File "/home/tremolux/Projects/precise/software-center_review_mvo_recommender_uuid_consolidation/software-center/softwarecenter/backend/recagent.py", line 236, in _set_recommender_uuid
config.set("general", "recommender_uuid", self.recommender_uuid)
File "/usr/lib/python2.7/ConfigParser.py", line 753, in set
ConfigParser.set(self, section, option, value)
File "/usr/lib/python2.7/ConfigParser.py", line 396, in set
raise NoSectionError(section)
ConfigParser.NoSectionError: No section: 'general'
Hi mvo, thanks for this! I think it's a good idea to consolidate the UUID stuff more, however, there are two reasons why I left the connection to app.py (with the signal). The first is because I planned to add an opt-out menu item (which will be a dead-simple change). The second is that I thought it best to keep all of the code that writes to the main config file in one place, that is, in app.py. Else somebody else will have to search if they want to explain where this mysterious other field is coming from in the main config file.
In any case, I am seeing two problems with it the current branch. One is a failure in the unit test, the other occurs when running the app itself (specifically, soemthing that would occur during a first run in a new install, further details below).
First, the unit test:
======= ======= ======= ======= ======= ======= ======= ======= ======= ======= recagent_ post_submit_ profile (__main_ _.TestRecommend erAgent) ------- ------- ------- ------- ------- ------- ------- ------- ------- recagent_ post_submit_ profile _agent. post_submit_ profile( db) tremolux/ Projects/ precise/ software- center_ review_ mvo_recommender _uuid_consolida tion/software- center/ softwarecenter/ backend/ recagent. py", line 98, in post_submit_profile recommender_ uuid = get_uuid() tremolux/ Projects/ precise/ software- center_ review_ mvo_recommender _uuid_consolida tion/software- center/ softwarecenter/ backend/ recagent. py", line 236, in _set_recommende r_uuid set("general" , "recommender_uuid", self.recommende r_uuid) python2. 7/ConfigParser. py", line 753, in set r.set(self, section, option, value) python2. 7/ConfigParser. py", line 396, in set section)
ERROR: test_mocked_
-------
Traceback (most recent call last):
File "test_recagent.py", line 48, in test_mocked_
recommender
File "/home/
self.
File "/home/
config.
File "/usr/lib/
ConfigParse
File "/usr/lib/
raise NoSectionError(
NoSectionError: No section: 'general'
======= ======= ======= ======= ======= ======= ======= ======= ======= ======= recommender_ uuid_property (__main_ _.TestRecommend erAgent) ------- ------- ------- ------- ------- ------- ------- ------- ------- recommender_ uuid_property assertEqual( recommender_ agent.recommend er_uuid, "foxy-uuid")
FAIL: test_recagent_
-------
Traceback (most recent call last):
File "test_recagent.py", line 161, in test_recagent_
self.
AssertionError: '' != 'foxy-uuid'
------- ------- ------- ------- ------- ------- ------- ------- ------- -------
Ran 7 tests in 6.296s
FAILED (failures=1, errors=1)
---
And the failure with the app itself occurs in the case where we have not yet made the cfg file (you can see this with a 'rm .config/ software- center/ softwarecenter. cfg'). This would happen on first run of software-center for a new install, for instance, and if the user opt-in to recommendations then. What happens in the UI is that the "Uploading user profile" spinner hangs.
Traceback (most recent call last): tremolux/ Projects/ precise/ software- center_ review_ mvo_recommender _uuid_consolida tion/software- center/ softwarecenter/ ui/gtk3/ widgets/ recommendations .py", line 127, in _on_opt_ in_button_ clicked _upload_ user_profile_ and_get_ recommendations () tremolux/ Projects/ precise/ software- center_ review_ mvo_recommender _uuid_consolida tion/software- center/ softwarecenter/ ui/gtk3/ widgets/ recommendations .py", line 131, in _upload_ user_profile_ and_get_ recommendations _upload_ user_profile( ) tremolux/ Projects/ precise/ software- center_ review_ mvo_recommender _uuid_consolida tion/software- center/ softwarecenter/ ui/gtk3/ widgets/ recommendations .py", line 139, in _upload_ user_profile recommender_ agent.post_ submit_ profile( self.catview. db) tremolux/ Projects/ precise/ software- center_ review_ mvo_recommender _uuid_consolida tion/software- center/ softwarecenter/ backend/ recagent. py", line 98, in post_submit_profile recommender_ uuid = get_uuid() tremolux/ Projects/ precise/ software- center_ review_ mvo_recommender _uuid_consolida tion/software- center/ softwarecenter/ backend/ recagent. py", line 236, in _set_recommende r_uuid set("general" , "recommender_uuid", self.recommende r_uuid) python2. 7/ConfigParser. py", line 753, in set r.set(self, section, option, value) python2. 7/ConfigParser. py", line 396, in set section) NoSectionError: No section: 'general'
File "/home/
self.
File "/home/
self.
File "/home/
self.
File "/home/
self.
File "/home/
config.
File "/usr/lib/
ConfigParse
File "/usr/lib/
raise NoSectionError(
ConfigParser.