|
@ -152,11 +152,18 @@ def show( request, server ): |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def showTexture( request, server ): |
|
|
|
|
|
|
|
|
def showTexture( request, server, userid = None ): |
|
|
"""Pack the currently logged in user's texture (if any) into an HttpResponse.""" |
|
|
"""Pack the currently logged in user's texture (if any) into an HttpResponse.""" |
|
|
|
|
|
srv = get_object_or_404( Mumble, id=int(server) ); |
|
|
|
|
|
|
|
|
|
|
|
if userid is None: |
|
|
if request.user.is_authenticated(): |
|
|
if request.user.is_authenticated(): |
|
|
srv = Mumble.objects.get( id=int(server) ); |
|
|
|
|
|
user = MumbleUser.objects.get( server=srv, owner=request.user ); |
|
|
|
|
|
|
|
|
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) ); |
|
|
|
|
|
|
|
|
try: |
|
|
try: |
|
|
img = user.getTexture(); |
|
|
img = user.getTexture(); |
|
|
except ValueError: |
|
|
except ValueError: |
|
@ -165,7 +172,6 @@ def showTexture( request, server ): |
|
|
buffer = StringIO(); |
|
|
buffer = StringIO(); |
|
|
img.save( buffer, "PNG" ); |
|
|
img.save( buffer, "PNG" ); |
|
|
return HttpResponse( buffer.getvalue(), "image/png" ); |
|
|
return HttpResponse( buffer.getvalue(), "image/png" ); |
|
|
raise Http404(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|