Changes ternary conditionals to be PEP308 compliant (#5827)

This commit is contained in:
Kent Kawashima 2018-02-14 23:06:09 +09:00 committed by Tom Christie
parent 7d0d22ffaa
commit d82b332a09
2 changed files with 3 additions and 3 deletions

View File

@ -33,8 +33,8 @@ And now we can add a `.save()` method to our model class:
representation of the code snippet.
"""
lexer = get_lexer_by_name(self.language)
linenos = self.linenos and 'table' or False
options = self.title and {'title': self.title} or {}
linenos = 'table' if self.linenos else False
options = {'title': self.title} if self.title else {}
formatter = HtmlFormatter(style=self.style, linenos=linenos,
full=True, **options)
self.highlighted = highlight(self.code, lexer, formatter)

View File

@ -148,7 +148,7 @@ class SimpleRouter(BaseRouter):
]
def __init__(self, trailing_slash=True):
self.trailing_slash = trailing_slash and '/' or ''
self.trailing_slash = '/' if trailing_slash else ''
super(SimpleRouter, self).__init__()
def get_default_base_name(self, viewset):