From 0a057b5508dd64b75b23cd38fb358122dfdd52f9 Mon Sep 17 00:00:00 2001 From: Michael Ziegler Date: Sun, 14 Mar 2010 16:35:47 +0100 Subject: [PATCH] a few cleanups --- pyweb/mumble/mmobjects.py | 6 +++--- pyweb/mumble/urls.py | 1 - pyweb/mumble/views.py | 13 +++---------- 3 files changed, 6 insertions(+), 14 deletions(-) diff --git a/pyweb/mumble/mmobjects.py b/pyweb/mumble/mmobjects.py index 0427ebe..6bc2919 100644 --- a/pyweb/mumble/mmobjects.py +++ b/pyweb/mumble/mmobjects.py @@ -170,10 +170,10 @@ class mmChannel( object ): "id": self.id, "rel": "channel", }, - 'data': self.name, - 'children': [ sc.asMvJson() for sc in self.subchans ] + \ + "data": self.name, + "children": [ sc.asMvJson() for sc in self.subchans ] + \ [ pl.asMvJson() for pl in self.players ], - 'state': { False: "closed", True: "open" }[self.top_or_not_empty], + "state": { False: "closed", True: "open" }[self.top_or_not_empty], } diff --git a/pyweb/mumble/urls.py b/pyweb/mumble/urls.py index 36fbb11..776e5bb 100644 --- a/pyweb/mumble/urls.py +++ b/pyweb/mumble/urls.py @@ -22,7 +22,6 @@ urlpatterns = patterns( ( r'(?P\d+)/users', 'users' ), ( r'(?P\d+)/(?P\d+)/texture.png', 'showTexture' ), - ( r'(?P\d+)/texture.png', 'showTexture' ), ( r'murmur/tree/(?P\d+)', 'mmng_tree' ), ( r'mumbleviewer/(?P\d+).xml', 'mumbleviewer_tree_xml' ), diff --git a/pyweb/mumble/views.py b/pyweb/mumble/views.py index b3e09ca..3574860 100644 --- a/pyweb/mumble/views.py +++ b/pyweb/mumble/views.py @@ -236,21 +236,14 @@ def mobile_show( request, server ): -def showTexture( request, server, userid = None ): +def showTexture( request, server, userid ): """ Pack the given user's texture into an HttpResponse. If userid is none, use the currently logged in User. """ - srv = get_object_or_404( Mumble, id=int(server) ); - - if userid is None: - if request.user.is_authenticated(): - user = get_object_or_404( MumbleUser, server=srv, owner=request.user ); - else: - raise Http404(); - else: - user = get_object_or_404( MumbleUser, server=srv, id=int(userid) ); + srv = get_object_or_404( Mumble, id=int(server) ); + user = get_object_or_404( MumbleUser, server=srv, id=int(userid) ); try: img = user.getTexture();