Browse Source

a few cleanups

Natenom/support-murmur-13-1446181288462
Michael Ziegler 15 years ago
parent
commit
0a057b5508
  1. 6
      pyweb/mumble/mmobjects.py
  2. 1
      pyweb/mumble/urls.py
  3. 13
      pyweb/mumble/views.py

6
pyweb/mumble/mmobjects.py

@ -170,10 +170,10 @@ class mmChannel( object ):
"id": self.id, "id": self.id,
"rel": "channel", "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 ], [ 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],
} }

1
pyweb/mumble/urls.py

@ -22,7 +22,6 @@ urlpatterns = patterns(
( r'(?P<server>\d+)/users', 'users' ), ( r'(?P<server>\d+)/users', 'users' ),
( r'(?P<server>\d+)/(?P<userid>\d+)/texture.png', 'showTexture' ), ( r'(?P<server>\d+)/(?P<userid>\d+)/texture.png', 'showTexture' ),
( r'(?P<server>\d+)/texture.png', 'showTexture' ),
( r'murmur/tree/(?P<server>\d+)', 'mmng_tree' ), ( r'murmur/tree/(?P<server>\d+)', 'mmng_tree' ),
( r'mumbleviewer/(?P<server>\d+).xml', 'mumbleviewer_tree_xml' ), ( r'mumbleviewer/(?P<server>\d+).xml', 'mumbleviewer_tree_xml' ),

13
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. """ Pack the given user's texture into an HttpResponse.
If userid is none, use the currently logged in User. 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: try:
img = user.getTexture(); img = user.getTexture();

Loading…
Cancel
Save