fix the stuff 2to3 got wrong
This commit is contained in:
parent
3a7b952090
commit
9e5709d200
|
@ -91,7 +91,7 @@ class Camp(CreatedUpdatedModel, UUIDModel):
|
||||||
field = getattr(self, camppart)
|
field = getattr(self, camppart)
|
||||||
|
|
||||||
if not hasattr(field, '__class__') or not hasattr(field.__class__, '__name__') or not field.__class__.__name__ == 'DateTimeTZRange':
|
if not hasattr(field, '__class__') or not hasattr(field.__class__, '__name__') or not field.__class__.__name__ == 'DateTimeTZRange':
|
||||||
print(("this attribute is not a datetimetzrange field: %s" % field))
|
print("this attribute is not a datetimetzrange field: %s" % field)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
daycount = (field.upper - field.lower).days
|
daycount = (field.upper - field.lower).days
|
||||||
|
|
|
@ -24,19 +24,19 @@ class Plugin(object):
|
||||||
def server_ready(self, **kwargs):
|
def server_ready(self, **kwargs):
|
||||||
"""triggered after the server sent the MOTD (require core plugin)"""
|
"""triggered after the server sent the MOTD (require core plugin)"""
|
||||||
if settings.DEBUG:
|
if settings.DEBUG:
|
||||||
print(("inside server_ready(), kwargs: %s" % kwargs))
|
print("inside server_ready(), kwargs: %s" % kwargs)
|
||||||
|
|
||||||
|
|
||||||
def connection_lost(self, **kwargs):
|
def connection_lost(self, **kwargs):
|
||||||
"""triggered when connection is lost"""
|
"""triggered when connection is lost"""
|
||||||
if settings.DEBUG:
|
if settings.DEBUG:
|
||||||
print(("inside connection_lost(), kwargs: %s" % kwargs))
|
print("inside connection_lost(), kwargs: %s" % kwargs)
|
||||||
|
|
||||||
|
|
||||||
def connection_made(self, **kwargs):
|
def connection_made(self, **kwargs):
|
||||||
"""triggered when connection is up"""
|
"""triggered when connection is up"""
|
||||||
if settings.DEBUG:
|
if settings.DEBUG:
|
||||||
print(("inside connection_made(), kwargs: %s" % kwargs))
|
print("inside connection_made(), kwargs: %s" % kwargs)
|
||||||
|
|
||||||
|
|
||||||
###############################################################################################
|
###############################################################################################
|
||||||
|
@ -46,7 +46,7 @@ class Plugin(object):
|
||||||
def on_join_part_quit(self, **kwargs):
|
def on_join_part_quit(self, **kwargs):
|
||||||
"""triggered when there is a join part or quit on a channel the bot is in"""
|
"""triggered when there is a join part or quit on a channel the bot is in"""
|
||||||
if settings.DEBUG:
|
if settings.DEBUG:
|
||||||
print(("inside on_join_part_quit(), kwargs: %s" % kwargs))
|
print("inside on_join_part_quit(), kwargs: %s" % kwargs)
|
||||||
if self.bot.nick == kwargs['mask'].split("!")[0] and kwargs['channel'] == "#tirsdagsfilm":
|
if self.bot.nick == kwargs['mask'].split("!")[0] and kwargs['channel'] == "#tirsdagsfilm":
|
||||||
self.bot.loop.call_later(1, self.bot.get_outgoing_messages)
|
self.bot.loop.call_later(1, self.bot.get_outgoing_messages)
|
||||||
|
|
||||||
|
@ -55,13 +55,13 @@ class Plugin(object):
|
||||||
def on_privmsg(self, **kwargs):
|
def on_privmsg(self, **kwargs):
|
||||||
"""triggered when a privmsg is sent to the bot or to a channel the bot is in"""
|
"""triggered when a privmsg is sent to the bot or to a channel the bot is in"""
|
||||||
if settings.DEBUG:
|
if settings.DEBUG:
|
||||||
print(("inside on_privmsg(), kwargs: %s" % kwargs))
|
print("inside on_privmsg(), kwargs: %s" % kwargs)
|
||||||
|
|
||||||
|
|
||||||
@irc3.event(irc3.rfc.KICK)
|
@irc3.event(irc3.rfc.KICK)
|
||||||
def on_kick(self, **kwargs):
|
def on_kick(self, **kwargs):
|
||||||
if settings.DEBUG:
|
if settings.DEBUG:
|
||||||
print(("inside on_kick(), kwargs: %s" % kwargs))
|
print("inside on_kick(), kwargs: %s" % kwargs)
|
||||||
|
|
||||||
|
|
||||||
###############################################################################################
|
###############################################################################################
|
||||||
|
@ -78,12 +78,12 @@ class Plugin(object):
|
||||||
print("inside get_outgoing_messages()")
|
print("inside get_outgoing_messages()")
|
||||||
for msg in OutgoingIrcMessage.objects.filter(processed=False).order_by('created_date'):
|
for msg in OutgoingIrcMessage.objects.filter(processed=False).order_by('created_date'):
|
||||||
if msg.target[0] == "#" and msg.target in self.bot.channels:
|
if msg.target[0] == "#" and msg.target in self.bot.channels:
|
||||||
print(("sending privmsg to %s: %s" % (msg.target, msg.message)))
|
print("sending privmsg to %s: %s" % (msg.target, msg.message))
|
||||||
self.bot.privmsg(msg.target, msg.message)
|
self.bot.privmsg(msg.target, msg.message)
|
||||||
msg.processed=True
|
msg.processed=True
|
||||||
msg.save()
|
msg.save()
|
||||||
else:
|
else:
|
||||||
print(("skipping message to channel %s because the bot is not in the channel" % msg.target))
|
print("skipping message to channel %s because the bot is not in the channel" % msg.target)
|
||||||
|
|
||||||
# call this function again in 60 seconds
|
# call this function again in 60 seconds
|
||||||
self.bot.loop.call_later(60, self.bot.get_outgoing_messages)
|
self.bot.loop.call_later(60, self.bot.get_outgoing_messages)
|
||||||
|
|
|
@ -538,7 +538,7 @@ class CoinifyRedirectView(LoginRequiredMixin, EnsureUserOwnsOrderMixin, EnsureUn
|
||||||
# check if it expired
|
# check if it expired
|
||||||
if parse_datetime(order.coinifyapiinvoice.invoicejson['expire_time']) < timezone.now():
|
if parse_datetime(order.coinifyapiinvoice.invoicejson['expire_time']) < timezone.now():
|
||||||
# this coinifyinvoice expired, delete it
|
# this coinifyinvoice expired, delete it
|
||||||
print(("deleting expired coinifyinvoice id %s" % order.coinifyapiinvoice.invoicejson['id']))
|
print("deleting expired coinifyinvoice id %s" % order.coinifyapiinvoice.invoicejson['id'])
|
||||||
order.coinifyapiinvoice.delete()
|
order.coinifyapiinvoice.delete()
|
||||||
order = self.get_object()
|
order = self.get_object()
|
||||||
|
|
||||||
|
@ -565,10 +565,10 @@ class CoinifyRedirectView(LoginRequiredMixin, EnsureUserOwnsOrderMixin, EnsureUn
|
||||||
# Parse response
|
# Parse response
|
||||||
if not response['success']:
|
if not response['success']:
|
||||||
api_error = response['error']
|
api_error = response['error']
|
||||||
print(("API error: %s (%s)" % (
|
print("API error: %s (%s)" % (
|
||||||
api_error['message'],
|
api_error['message'],
|
||||||
api_error['code']
|
api_error['code']
|
||||||
)))
|
))
|
||||||
messages.error(request, "There was a problem with the payment provider. Please try again later")
|
messages.error(request, "There was a problem with the payment provider. Please try again later")
|
||||||
return HttpResponseRedirect(reverse_lazy('shop:order_detail', kwargs={'pk': self.get_object().pk}))
|
return HttpResponseRedirect(reverse_lazy('shop:order_detail', kwargs={'pk': self.get_object().pk}))
|
||||||
else:
|
else:
|
||||||
|
@ -577,7 +577,7 @@ class CoinifyRedirectView(LoginRequiredMixin, EnsureUserOwnsOrderMixin, EnsureUn
|
||||||
invoicejson = response['data'],
|
invoicejson = response['data'],
|
||||||
order = order,
|
order = order,
|
||||||
)
|
)
|
||||||
print(("created new coinifyinvoice id %s" % coinifyinvoice.invoicejson['id']))
|
print("created new coinifyinvoice id %s" % coinifyinvoice.invoicejson['id'])
|
||||||
return super(CoinifyRedirectView, self).dispatch(
|
return super(CoinifyRedirectView, self).dispatch(
|
||||||
request, *args, **kwargs
|
request, *args, **kwargs
|
||||||
)
|
)
|
||||||
|
@ -622,7 +622,7 @@ class CoinifyCallbackView(SingleObjectMixin, View):
|
||||||
try:
|
try:
|
||||||
coinifyinvoice = CoinifyAPIInvoice.objects.get(invoicejson__id=callbackjson['data']['id'])
|
coinifyinvoice = CoinifyAPIInvoice.objects.get(invoicejson__id=callbackjson['data']['id'])
|
||||||
except CoinifyAPIInvoice.DoesNotExist:
|
except CoinifyAPIInvoice.DoesNotExist:
|
||||||
print(("unable to find CoinifyAPIInvoice with id %s" % callbackjson['data']['id']))
|
print("unable to find CoinifyAPIInvoice with id %s" % callbackjson['data']['id'])
|
||||||
return HttpResponseBadRequest('bad coinifyinvoice id')
|
return HttpResponseBadRequest('bad coinifyinvoice id')
|
||||||
|
|
||||||
# save new coinifyinvoice payload
|
# save new coinifyinvoice payload
|
||||||
|
|
|
@ -29,11 +29,11 @@ class Command(BaseCommand):
|
||||||
),
|
),
|
||||||
camp=(
|
camp=(
|
||||||
timezone.datetime(2016, 8, 27, 12, 0, tzinfo=timezone.utc),
|
timezone.datetime(2016, 8, 27, 12, 0, tzinfo=timezone.utc),
|
||||||
timezone.datetime(2016, 9, 0o4, 11, 59, tzinfo=timezone.utc),
|
timezone.datetime(2016, 9, 4, 11, 59, tzinfo=timezone.utc),
|
||||||
),
|
),
|
||||||
teardown=(
|
teardown=(
|
||||||
timezone.datetime(2016, 9, 0o4, 12, 0, tzinfo=timezone.utc),
|
timezone.datetime(2016, 9, 4, 12, 0, tzinfo=timezone.utc),
|
||||||
timezone.datetime(2016, 9, 0o6, 12, 0, tzinfo=timezone.utc),
|
timezone.datetime(2016, 9, 6, 12, 0, tzinfo=timezone.utc),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -47,11 +47,11 @@ class Command(BaseCommand):
|
||||||
),
|
),
|
||||||
camp=(
|
camp=(
|
||||||
timezone.datetime(2017, 8, 27, 12, 0, tzinfo=timezone.utc),
|
timezone.datetime(2017, 8, 27, 12, 0, tzinfo=timezone.utc),
|
||||||
timezone.datetime(2017, 9, 0o4, 11, 59, tzinfo=timezone.utc),
|
timezone.datetime(2017, 9, 4, 11, 59, tzinfo=timezone.utc),
|
||||||
),
|
),
|
||||||
teardown=(
|
teardown=(
|
||||||
timezone.datetime(2017, 9, 0o4, 12, 0, tzinfo=timezone.utc),
|
timezone.datetime(2017, 9, 4, 12, 0, tzinfo=timezone.utc),
|
||||||
timezone.datetime(2017, 9, 0o6, 12, 0, tzinfo=timezone.utc),
|
timezone.datetime(2017, 9, 6, 12, 0, tzinfo=timezone.utc),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -65,11 +65,11 @@ class Command(BaseCommand):
|
||||||
),
|
),
|
||||||
camp=(
|
camp=(
|
||||||
timezone.datetime(2018, 8, 27, 12, 0, tzinfo=timezone.utc),
|
timezone.datetime(2018, 8, 27, 12, 0, tzinfo=timezone.utc),
|
||||||
timezone.datetime(2018, 9, 0o4, 11, 59, tzinfo=timezone.utc),
|
timezone.datetime(2018, 9, 4, 11, 59, tzinfo=timezone.utc),
|
||||||
),
|
),
|
||||||
teardown=(
|
teardown=(
|
||||||
timezone.datetime(2018, 9, 0o4, 12, 0, tzinfo=timezone.utc),
|
timezone.datetime(2018, 9, 4, 12, 0, tzinfo=timezone.utc),
|
||||||
timezone.datetime(2018, 9, 0o6, 12, 0, tzinfo=timezone.utc),
|
timezone.datetime(2018, 9, 6, 12, 0, tzinfo=timezone.utc),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue