mirror of
https://gitlab.com/allianceauth/allianceauth.git
synced 2025-07-12 14:00:17 +02:00
* Correct duplicate error and success messages to user * Read out all buffer bytes before sending command * Convert ts3 manager to use a single connection Each instance of the class will now use a single connection and should be cleanly disconnected when finished. Compatible with `with` clauses and will automatically disconnect from the TS3 server when it exits the `with` block. * Update TS3 manager consumers to use new style * Update unit tests to use new style manager
17 lines
542 B
Python
17 lines
542 B
Python
from __future__ import unicode_literals
|
|
|
|
from django import forms
|
|
from django.utils.translation import ugettext_lazy as _
|
|
|
|
from .manager import Teamspeak3Manager
|
|
|
|
|
|
class TeamspeakJoinForm(forms.Form):
|
|
username = forms.CharField(widget=forms.HiddenInput())
|
|
|
|
def clean(self):
|
|
with Teamspeak3Manager() as ts3man:
|
|
if ts3man._get_userid(self.cleaned_data['username']):
|
|
return self.cleaned_data
|
|
raise forms.ValidationError(_("Unable to locate user %s on server") % self.cleaned_data['username'])
|