Merge lp:~mvo/software-center/improve-debug-in-piston-generic-helper into lp:software-center

Proposed by Michael Vogt
Status: Merged
Merged at revision: 2666
Proposed branch: lp:~mvo/software-center/improve-debug-in-piston-generic-helper
Merge into: lp:software-center
Diff against target: 40 lines (+24/-0)
2 files modified
README.debug-server (+17/-0)
utils/piston-helpers/piston_generic_helper.py (+7/-0)
To merge this branch: bzr merge lp:~mvo/software-center/improve-debug-in-piston-generic-helper
Reviewer Review Type Date Requested Status
Gary Lasker (community) Approve
Review via email: mp+88833@code.launchpad.net

Description of the change

Trivial branch to improve debug output of piston-generic-helper and a README with examples how
it can be used to debug server side issues.

To post a comment you must log in.
Revision history for this message
Gary Lasker (gary-lasker) wrote :

Nice!! And extra special kudos for README awesomeness.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added file 'README.debug-server'
--- README.debug-server 1970-01-01 00:00:00 +0000
+++ README.debug-server 2012-01-17 10:49:23 +0000
@@ -0,0 +1,17 @@
1When debugging server issues or inspecting the expected results
2its often useful to run
3"utils/piston-helpers/piston_generic_helper.py" in debug mode.
4
5Some examples:
6$ PYTHONPATH=. utils/piston-helpers/piston_generic_helper.py \
7 --output=text --debug --needs-auth \
8 SoftwareCenterAgentAPI subscriptions_for_me
9
10$ PYTHONPATH=. utils/piston-helpers/piston_generic_helper.py \
11 --output=text --debug \
12 SoftwareCenterRecommenderAPI recommend_top
13
14
15
16Any piston-mini-client API should work, first name is the class
17second the method to run, optional is a json encoded kwargs string.
0\ No newline at end of file18\ No newline at end of file
119
=== modified file 'utils/piston-helpers/piston_generic_helper.py'
--- utils/piston-helpers/piston_generic_helper.py 2012-01-06 05:23:30 +0000
+++ utils/piston-helpers/piston_generic_helper.py 2012-01-17 10:49:23 +0000
@@ -200,6 +200,13 @@
200 LOG.warn("no data")200 LOG.warn("no data")
201 sys.exit(0)201 sys.exit(0)
202202
203 if args.debug:
204 for itm in piston_reply:
205 s = "** itm: %s\n" % itm
206 for var in vars(itm):
207 s += "%s: '%s'\n" % (var, getattr(itm, var))
208 LOG.debug(s)
209
203 # check what format to use210 # check what format to use
204 if args.output == "pickle":211 if args.output == "pickle":
205 res = pickle.dumps(piston_reply)212 res = pickle.dumps(piston_reply)

Subscribers

People subscribed via source and target branches