diff --git a/docs/tutorial/4-authentication-and-permissions.md b/docs/tutorial/4-authentication-and-permissions.md index af9a7c0ff..5348ade33 100644 --- a/docs/tutorial/4-authentication-and-permissions.md +++ b/docs/tutorial/4-authentication-and-permissions.md @@ -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) diff --git a/rest_framework/routers.py b/rest_framework/routers.py index 9007788f8..281bbde8a 100644 --- a/rest_framework/routers.py +++ b/rest_framework/routers.py @@ -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):