Invalid syntax in this simple Python application.
- by Sergio Boombastic
Getting an invalid syntax when creating the template_value variable:
class MainPage(webapp.RequestHandler):
def get(self):
blogPosts_query = BlogPost.all().order('-postDate')
blogPosts = blogPosts_query.fetch(10)
if users.get_current_user():
url = users.create_logout_url(self.request.uri)
url_linktext = 'Logout'
else:
url = url = users.create_login_url(self.request.uri)
url_linktext = 'Login'
template_value = (
'blogPosts': blogPosts,
'url': url,
'url_linktext': url_linktext,
)
path = os.path.join(os.path.dirname(__file__), 'index.html')
self.response.out.write(template.render(path, template_values))
The error fires specifically on the 'blogPosts': blogPosts line.
What am I doing wrong?
Thanks!