Created
July 3, 2009 08:26
-
-
Save wozozo/140003 to your computer and use it in GitHub Desktop.
This file contains 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 juno import * | |
Person = model('Person', name='str', views='int') | |
@route('/makeperson/*:name/') | |
def makeperson(web, name): | |
exist = Person.find().filter(Person.name==name) | |
if exist.count() != 0: return 'That person already exists' | |
p = Person(name=name, views=0).save() | |
return 'Person created' | |
@route('/getperson/*:name/') | |
def getperson(web, name): | |
exist = Person.find().filter(Person.name==name).all() | |
if len(exist) == 0: return 'That person does not exist' | |
p = exist[0] | |
p.views += 1 | |
p.save() | |
return 'You have viewed this person %s time(s)' % p.views | |
run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment