This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# | |
# Copyright 2007 Google Inc. | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from google.appengine.ext import db | |
class User(db.Model): | |
account = db.StringProperty() | |
password = db.StringProperty() | |
name = db.StringProperty() | |
created = db.DateTimeProperty(auto_now=True) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class VoteHandler(webapp.RequestHandler): | |
#read value of counter, calculate new value, then store it | |
def get(self): | |
doRender(self, 'base/index.html') | |
def post(self): | |
#See if logged in | |
self.Session = Session() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class VoteHandler(webapp.RequestHandler): | |
#read value of counter, calculate new value, then store it | |
def get(self): | |
doRender(self, 'base/index.html') | |
def post(self): | |
#See if logged in | |
self.Session = Session() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get(self): | |
que = db.Query(models.URL) | |
url_list = que.fetch(limit=100) | |
new_list = url_list.reverse() | |
path = self.request.path | |
if doRender(self,path): | |
return | |
doRender(self,'base/index.html', { 'new_list' : new_list }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% extends "_base.html" %} | |
{% block title %} | |
Index | |
{% endblock %} | |
{% block maincontent %} | |
<h2>Websites from index.html</h2> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class VoteHandler(webapp.RequestHandler): | |
def get(self): | |
#See if logged in | |
self.Session = Session() | |
if not 'userkey' in self.Session: | |
doRender( | |
self, | |
'/', | |
{'error' : 'Please login to vote'}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class VoteHandler(webapp.RequestHandler): | |
def get(self): | |
#See if logged in | |
self.Session = Session() | |
if not 'userkey' in self.Session: | |
doRender( | |
self, | |
'base/index.html', | |
{'error' : 'Please login to vote'}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from google.appengine.ext import db | |
class User(db.Model): | |
account = db.StringProperty() | |
password = db.StringProperty() | |
name = db.StringProperty() | |
created = db.DateTimeProperty(auto_now=True) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for vurl.votes: | |
if not vurl.user: | |
vurl.votes += 1 | |
vurl.put() | |