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)
|
||||
|
||||
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
|
||||
|
||||
daycount = (field.upper - field.lower).days
|
||||
|
|
|
@ -24,19 +24,19 @@ class Plugin(object):
|
|||
def server_ready(self, **kwargs):
|
||||
"""triggered after the server sent the MOTD (require core plugin)"""
|
||||
if settings.DEBUG:
|
||||
print(("inside server_ready(), kwargs: %s" % kwargs))
|
||||
print("inside server_ready(), kwargs: %s" % kwargs)
|
||||
|
||||
|
||||
def connection_lost(self, **kwargs):
|
||||
"""triggered when connection is lost"""
|
||||
if settings.DEBUG:
|
||||
print(("inside connection_lost(), kwargs: %s" % kwargs))
|
||||
print("inside connection_lost(), kwargs: %s" % kwargs)
|
||||
|
||||
|
||||
def connection_made(self, **kwargs):
|
||||
"""triggered when connection is up"""
|
||||
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):
|
||||
"""triggered when there is a join part or quit on a channel the bot is in"""
|
||||
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":
|
||||
self.bot.loop.call_later(1, self.bot.get_outgoing_messages)
|
||||
|
||||
|
@ -55,13 +55,13 @@ class Plugin(object):
|
|||
def on_privmsg(self, **kwargs):
|
||||
"""triggered when a privmsg is sent to the bot or to a channel the bot is in"""
|
||||
if settings.DEBUG:
|
||||
print(("inside on_privmsg(), kwargs: %s" % kwargs))
|
||||
print("inside on_privmsg(), kwargs: %s" % kwargs)
|
||||
|
||||
|
||||
@irc3.event(irc3.rfc.KICK)
|
||||
def on_kick(self, **kwargs):
|
||||
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()")
|
||||
for msg in OutgoingIrcMessage.objects.filter(processed=False).order_by('created_date'):
|
||||
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)
|
||||
msg.processed=True
|
||||
msg.save()
|
||||
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
|
||||
self.bot.loop.call_later(60, self.bot.get_outgoing_messages)
|
||||
|
|
|
@ -7,7 +7,7 @@ import io
|
|||
def generate_pdf_letter(filename, template, formatdict):
|
||||
### produce text-only PDF from template
|
||||
pdfgenerator = PDFTemplateResponse(
|
||||
request=RequestFactory().get('/'),
|
||||
request=RequestFactory().get('/'),
|
||||
template=template,
|
||||
context=formatdict,
|
||||
cmd_options={
|
||||
|
@ -45,6 +45,6 @@ def generate_pdf_letter(filename, template, formatdict):
|
|||
|
||||
### return a file object with the data
|
||||
returnfile = io.StringIO()
|
||||
finalpdf.write(returnfile)
|
||||
finalpdf.write(returnfile)
|
||||
return returnfile
|
||||
|
||||
|
|
|
@ -538,7 +538,7 @@ class CoinifyRedirectView(LoginRequiredMixin, EnsureUserOwnsOrderMixin, EnsureUn
|
|||
# check if it expired
|
||||
if parse_datetime(order.coinifyapiinvoice.invoicejson['expire_time']) < timezone.now():
|
||||
# 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 = self.get_object()
|
||||
|
||||
|
@ -549,7 +549,7 @@ class CoinifyRedirectView(LoginRequiredMixin, EnsureUserOwnsOrderMixin, EnsureUn
|
|||
settings.COINIFY_API_KEY,
|
||||
settings.COINIFY_API_SECRET
|
||||
)
|
||||
|
||||
|
||||
# create coinify API
|
||||
response = coinifyapi.invoice_create(
|
||||
float(order.total),
|
||||
|
@ -565,10 +565,10 @@ class CoinifyRedirectView(LoginRequiredMixin, EnsureUserOwnsOrderMixin, EnsureUn
|
|||
# Parse response
|
||||
if not response['success']:
|
||||
api_error = response['error']
|
||||
print(("API error: %s (%s)" % (
|
||||
print("API error: %s (%s)" % (
|
||||
api_error['message'],
|
||||
api_error['code']
|
||||
)))
|
||||
))
|
||||
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}))
|
||||
else:
|
||||
|
@ -577,7 +577,7 @@ class CoinifyRedirectView(LoginRequiredMixin, EnsureUserOwnsOrderMixin, EnsureUn
|
|||
invoicejson = response['data'],
|
||||
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(
|
||||
request, *args, **kwargs
|
||||
)
|
||||
|
@ -622,7 +622,7 @@ class CoinifyCallbackView(SingleObjectMixin, View):
|
|||
try:
|
||||
coinifyinvoice = CoinifyAPIInvoice.objects.get(invoicejson__id=callbackjson['data']['id'])
|
||||
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')
|
||||
|
||||
# save new coinifyinvoice payload
|
||||
|
|
|
@ -29,11 +29,11 @@ class Command(BaseCommand):
|
|||
),
|
||||
camp=(
|
||||
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=(
|
||||
timezone.datetime(2016, 9, 0o4, 12, 0, tzinfo=timezone.utc),
|
||||
timezone.datetime(2016, 9, 0o6, 12, 0, tzinfo=timezone.utc),
|
||||
timezone.datetime(2016, 9, 4, 12, 0, tzinfo=timezone.utc),
|
||||
timezone.datetime(2016, 9, 6, 12, 0, tzinfo=timezone.utc),
|
||||
),
|
||||
)
|
||||
|
||||
|
@ -47,11 +47,11 @@ class Command(BaseCommand):
|
|||
),
|
||||
camp=(
|
||||
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=(
|
||||
timezone.datetime(2017, 9, 0o4, 12, 0, tzinfo=timezone.utc),
|
||||
timezone.datetime(2017, 9, 0o6, 12, 0, tzinfo=timezone.utc),
|
||||
timezone.datetime(2017, 9, 4, 12, 0, tzinfo=timezone.utc),
|
||||
timezone.datetime(2017, 9, 6, 12, 0, tzinfo=timezone.utc),
|
||||
),
|
||||
)
|
||||
|
||||
|
@ -65,11 +65,11 @@ class Command(BaseCommand):
|
|||
),
|
||||
camp=(
|
||||
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=(
|
||||
timezone.datetime(2018, 9, 0o4, 12, 0, tzinfo=timezone.utc),
|
||||
timezone.datetime(2018, 9, 0o6, 12, 0, tzinfo=timezone.utc),
|
||||
timezone.datetime(2018, 9, 4, 12, 0, tzinfo=timezone.utc),
|
||||
timezone.datetime(2018, 9, 6, 12, 0, tzinfo=timezone.utc),
|
||||
),
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in a new issue