~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to lib/common/chat.py

  • Committer: dcoles
  • Date: 2008-02-13 04:10:55 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:443
Added Forum application along with unmodifed version of phpBB3 "Olympus" 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
import cjson
23
23
import cStringIO
24
24
import md5
25
 
import sys
26
25
import os
27
26
import socket
28
 
import traceback
29
27
 
30
28
def start_server(port, magic, daemon_mode, handler, initializer = None):
31
29
    # Attempt to open the socket.
76
74
            conn.sendall(cjson.encode(response))
77
75
 
78
76
            conn.close()
79
 
        except Exception:
80
 
            # Make a JSON object full of exceptional goodness
81
 
            tb_dump = cStringIO.StringIO()
82
 
            e_type, e_val, e_tb = sys.exc_info()
83
 
            traceback.print_tb(e_tb, file=tb_dump)
84
 
            json_exc = {
85
 
                "type": e_type.__name__,
86
 
                "value": str(e_val),
87
 
                "traceback": tb_dump.getvalue()
88
 
            }
89
 
            conn.sendall(cjson.encode(json_exc))
 
77
        except Exception, e:
 
78
            conn.sendall(cjson.encode(repr(e)))
90
79
            conn.close()
91
80
 
92
81