Skip to content

Commit

Permalink
Use format instead %
Browse files Browse the repository at this point in the history
  • Loading branch information
Francesco Scarlato (Jungmann) committed Jan 28, 2016
1 parent 4b37d36 commit 81590d0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion django_telegrambot/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__version__ = '0.1.3'
__version__ = '0.1.4'
default_app_config = 'django_telegrambot.apps.DjangoTelegramBot'
12 changes: 6 additions & 6 deletions django_telegrambot/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,13 @@ def ready(self):
for index, token in enumerate(tokens):

bot = telegram.Bot(token=token)
hookurl = '%s%s/%s/' % (webhook_site,webhook_base, token)
hookurl = '{}{}/{}/'.format(webhook_site,webhook_base, token)
if hasattr(settings, 'TELEGRAM_WEBHOOK_CERTIFICATE'):
setted = bot.setWebhook(hookurl, certificate=open(CERT,'rb'))
else:
setted = bot.setWebhook(hookurl, certificate=None)

print 'Telegram Bot <%s> setting webhook [ %s ] : %s'%(bot.username,hookurl,setted)
print 'Telegram Bot <{}> setting webhook [ {} ] : {}'.format(bot.username,hookurl,setted)

DjangoTelegramBot.dispatchers.append(telegram.Dispatcher(bot, None))
DjangoTelegramBot.bots.append(bot)
Expand All @@ -89,10 +89,10 @@ def module_exists(module_name, method_name, execute):
#m = __import__(module_name).telegrambot
m = importlib.import_module(module_name)
if execute and hasattr(m, method_name):
print 'Run %s.main()' % module_name
print 'Run {}.main()'.format(module_name)
getattr(m,method_name)()
else:
print 'Run %s' % module_name
print 'Run {}'.format(module_name)

except ImportError:
return False
Expand All @@ -101,9 +101,9 @@ def module_exists(module_name, method_name, execute):

# import telegram bot handlers for all INSTALLED_APPS
for app in settings.INSTALLED_APPS:
module_name = '%s.telegrambot' % app
module_name = '{}.telegrambot'.format( app )
if module_exists(module_name, 'main', True):
print 'Loaded %s' % module_name
print 'Loaded {}'.format( module_name)


#import telegrambot
Expand Down

0 comments on commit 81590d0

Please sign in to comment.