From e8490b511b24fb0db610f24952ed45f498bc038e Mon Sep 17 00:00:00 2001 From: Michael Ziegler Date: Fri, 18 Dec 2009 20:56:12 +0100 Subject: [PATCH] add a bit documentation --- pyweb/mumble/MumbleCtlDbus.py | 2 ++ pyweb/mumble/MumbleCtlIce.py | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/pyweb/mumble/MumbleCtlDbus.py b/pyweb/mumble/MumbleCtlDbus.py index df4e8f6..a8e2165 100644 --- a/pyweb/mumble/MumbleCtlDbus.py +++ b/pyweb/mumble/MumbleCtlDbus.py @@ -27,6 +27,8 @@ from dbus.exceptions import DBusException def MumbleCtlDbus( connstring ): + """ Choose the correct DBus handler (1.1.8 or legacy) to use. """ + meta = dbus.Interface( dbus.SystemBus().get_object( connstring, '/' ), 'net.sourceforge.mumble.Meta' ); try: diff --git a/pyweb/mumble/MumbleCtlIce.py b/pyweb/mumble/MumbleCtlIce.py index 83c10d9..32317cd 100644 --- a/pyweb/mumble/MumbleCtlIce.py +++ b/pyweb/mumble/MumbleCtlIce.py @@ -27,8 +27,15 @@ from mctl import MumbleCtlBase import Ice - def protectDjangoErrPage( func ): + """ Catch and reraise Ice exceptions to prevent the Django page from failing. + + Since I need to "import Murmur", Django would try to read a murmur.py file + which doesn't exist, and thereby produce an IndexError exception. This method + erases the exception's traceback, preventing Django from trying to read any + non-existant files and borking. + """ + def protection_wrapper( *args, **kwargs ): try: return func( *args, **kwargs ); @@ -37,8 +44,14 @@ def protectDjangoErrPage( func ): return protection_wrapper; + + @protectDjangoErrPage def MumbleCtlIce( connstring ): + """ Choose the correct Ice handler to use (1.1.8 or 1.2.0), and make sure the + Murmur version matches the slice Version. + """ + version = settings.SLICE_VERSION; slice = settings.SLICE;