11import random
22from collections import deque
33
4+ from slixmpp .exceptions import XMPPError
45from slixmpp .plugins import BasePlugin , register_plugin
56
67
@@ -22,7 +23,7 @@ def _start_voting(self, iq, session):
2223 raise XMPPError ('forbidden' )
2324
2425 ballot = self .xmpp ['xsf_voting' ].get_ballot ()
25- existing_voting_session = self .xmpp ['xsf_voting' ].get_session (iq ['from' ])
26+ self .xmpp ['xsf_voting' ].get_session (iq ['from' ])
2627
2728 form = self .xmpp ['xep_0004' ].stanza .Form ()
2829 form ['type' ] = 'form'
@@ -43,8 +44,8 @@ def _start_voting(self, iq, session):
4344 session ['next' ] = self ._handle_voting
4445 return session
4546
46- def _handle_voting (self , iq , session ):
47- voting_session = self .xmpp ['xsf_voting' ].start_voting (session ['from' ])
47+ def _handle_voting (self , _iq , session ):
48+ self .xmpp ['xsf_voting' ].start_voting (session ['from' ])
4849 section = session ['ballot_section' ]
4950
5051 form = self .xmpp ['xep_0004' ].stanza .Form ()
@@ -55,8 +56,8 @@ def _handle_voting(self, iq, session):
5556 random .shuffle (section ['items' ])
5657
5758 form .add_field (var = 'members' ,
58- ftype = 'list-multi' ,
59- label = 'Approved Members' )
59+ ftype = 'list-multi' ,
60+ label = 'Approved Members' )
6061 for item in section ['items' ]:
6162 form .field ['members' ].add_option (value = item ['name' ])
6263
@@ -65,7 +66,7 @@ def _handle_voting(self, iq, session):
6566 return session
6667
6768 def _handle_limited_voting (self , iq , session ):
68- voting_session = self .xmpp ['xsf_voting' ].start_voting (session ['from' ])
69+ self .xmpp ['xsf_voting' ].start_voting (session ['from' ])
6970 section = session ['ballot_section' ]
7071
7172 form = self .xmpp ['xep_0004' ].stanza .Form ()
@@ -78,8 +79,8 @@ def _handle_limited_voting(self, iq, session):
7879
7980 for i in range (0 , int (section ['limit' ])):
8081 form .add_field (var = 'choice-%s' % i ,
81- ftype = 'list-single' ,
82- label = 'Seat %s' % str (i + 1 ))
82+ ftype = 'list-single' ,
83+ label = 'Seat %s' % str (i + 1 ))
8384 for item in items :
8485 form .field ['choice-%s' % i ].add_option (value = item ['name' ])
8586 items .rotate (1 )
@@ -89,5 +90,4 @@ def _handle_limited_voting(self, iq, session):
8990 return session
9091
9192
92-
9393register_plugin (XSFVotingAdhoc )
0 commit comments