~zedtux/lpbugreporter/1.0

« back to all changes in this revision

Viewing changes to README

  • Committer: zedtux
  • Date: 2010-10-15 23:10:22 UTC
  • Revision ID: zedtux@zedroot.org-20101015231022-kf8tqjhqyovuga7b
Writed first version of the README to introduce how to implement lpbugreporter

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Launchpad Bug Reporter
 
2
======================
 
3
 
 
4
  LpBugReporter is a Python module that help your users to report bugs.
 
5
It will display the uncatched exception to the user and suggest him to check if
 
6
this bug is already reported.
 
7
 
 
8
  In the case that the bug is unknow from your project's Launchpad bugs page,
 
9
your users will be invited to report that bug directly in the new Bug page of
 
10
Launchpad.
 
11
 
 
12
 
 
13
Installation
 
14
------------
 
15
 
 
16
  To install LpBugReporter, you just need to add my PPA to your sources, and 
 
17
install it as following:
 
18
 
 
19
sudo add-apt-repository ppa:zedtux/lpbugreporter
 
20
sudo apt-get update
 
21
sudo apt-get install lpbugreporter
 
22
 
 
23
 
 
24
Implementation
 
25
--------------
 
26
 
 
27
  LpBugReporter should be implemented on top of your code to be able to catch any
 
28
not managed exception.
 
29
 
 
30
  In order to show you how to implement it into your project, I'm going to show
 
31
you an example.
 
32
Given the following files/folders tree:
 
33
 
 
34
  root/
 
35
    |
 
36
    `--my_app.py  # Main file
 
37
        |
 
38
        `--my_framework
 
39
              |
 
40
              `--first_class.py
 
41
              |
 
42
              `--second_class.py
 
43
 
 
44
  Everything should be done in the file 'my_app.py'.
 
45
The first step is to *try* to import lpbugreporter.
 
46
Second step is to embed all your code into a try: except:
 
47
Finally, in case of uncatched exception, call lpbugreporter for your project:
 
48
 
 
49
---[ On top of my_app.py ]------------------------------------------------------
 
50
 
 
51
try:
 
52
    import lpbugreporter
 
53
except:
 
54
    print "Warning: The Launchpad Bug Reporter module is not importable !"
 
55
    pass
 
56
 
 
57
try:
 
58
    #
 
59
    # All you import and code here
 
60
    #
 
61
    
 
62
except not SystemExit:
 
63
    import cStringIO
 
64
    import traceback
 
65
    stringio = cStringIO.StringIO()
 
66
    traceback.print_exc(file=stringio)
 
67
    try:
 
68
        lpbugreporter.LpBugReporter("YouApplicationName")
 
69
    except:
 
70
        print "An exception occured, but the Launchpad Bug Reporter module is missing or not importable."
 
71
        print
 
72
        print "Python traceback content was:"
 
73
        print stringio.getvalue()
 
74
        pass
 
75
---[ End Of File ]--------------------------------------------------------------