Skip to content

Instantly share code, notes, and snippets.

View emilepetrone's full-sized avatar
🏠
Working from home

Emile Petrone emilepetrone

🏠
Working from home
View GitHub Profile
#!/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
#
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)
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()
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()
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 })
{% extends "_base.html" %}
{% block title %}
Index
{% endblock %}
{% block maincontent %}
<h2>Websites from index.html</h2>
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'})
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'})
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)
for vurl.votes:
if not vurl.user:
vurl.votes += 1
vurl.put()