From 9e5709d20064ab9062c3154bc7b0ce798c5d737b Mon Sep 17 00:00:00 2001 From: Thomas Steen Rasmussen Date: Mon, 30 Jan 2017 12:22:43 +0100 Subject: [PATCH] fix the stuff 2to3 got wrong --- src/camps/models.py | 2 +- src/ircbot/irc3module.py | 16 ++++++++-------- src/shop/pdf.py | 4 ++-- src/shop/views.py | 12 ++++++------ .../management/commands/bootstrap-devsite.py | 18 +++++++++--------- 5 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/camps/models.py b/src/camps/models.py index c186ad1d..56e8269c 100644 --- a/src/camps/models.py +++ b/src/camps/models.py @@ -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 diff --git a/src/ircbot/irc3module.py b/src/ircbot/irc3module.py index 2dd2c0d2..feb28369 100644 --- a/src/ircbot/irc3module.py +++ b/src/ircbot/irc3module.py @@ -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) diff --git a/src/shop/pdf.py b/src/shop/pdf.py index 18445089..849c36e7 100644 --- a/src/shop/pdf.py +++ b/src/shop/pdf.py @@ -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 diff --git a/src/shop/views.py b/src/shop/views.py index da248306..950dcc1d 100644 --- a/src/shop/views.py +++ b/src/shop/views.py @@ -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 diff --git a/src/utils/management/commands/bootstrap-devsite.py b/src/utils/management/commands/bootstrap-devsite.py index 8b78d52f..76dba98e 100644 --- a/src/utils/management/commands/bootstrap-devsite.py +++ b/src/utils/management/commands/bootstrap-devsite.py @@ -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), ), )