Skip to content

Instantly share code, notes, and snippets.

@wozozo
Created July 3, 2009 08:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wozozo/140003 to your computer and use it in GitHub Desktop.
Save wozozo/140003 to your computer and use it in GitHub Desktop.
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