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
1=== added file 'README.debug-server'
2--- README.debug-server 1970-01-01 00:00:00 +0000
3+++ README.debug-server 2012-01-17 10:49:23 +0000
4@@ -0,0 +1,17 @@
5+When debugging server issues or inspecting the expected results
6+its often useful to run
7+"utils/piston-helpers/piston_generic_helper.py" in debug mode.
8+
9+Some examples:
10+$ PYTHONPATH=. utils/piston-helpers/piston_generic_helper.py \
11+ --output=text --debug --needs-auth \
12+ SoftwareCenterAgentAPI subscriptions_for_me
13+
14+$ PYTHONPATH=. utils/piston-helpers/piston_generic_helper.py \
15+ --output=text --debug \
16+ SoftwareCenterRecommenderAPI recommend_top
17+
18+
19+
20+Any piston-mini-client API should work, first name is the class
21+second the method to run, optional is a json encoded kwargs string.
22\ No newline at end of file
23
24=== modified file 'utils/piston-helpers/piston_generic_helper.py'
25--- utils/piston-helpers/piston_generic_helper.py 2012-01-06 05:23:30 +0000
26+++ utils/piston-helpers/piston_generic_helper.py 2012-01-17 10:49:23 +0000
27@@ -200,6 +200,13 @@
28 LOG.warn("no data")
29 sys.exit(0)
30
31+ if args.debug:
32+ for itm in piston_reply:
33+ s = "** itm: %s\n" % itm
34+ for var in vars(itm):
35+ s += "%s: '%s'\n" % (var, getattr(itm, var))
36+ LOG.debug(s)
37+
38 # check what format to use
39 if args.output == "pickle":
40 res = pickle.dumps(piston_reply)

Subscribers

People subscribed via source and target branches