view scripts/hyperdb_example.py @ 3896:fca0365521fc

ignore client shutdown exceptions when sending responses patch from Ulrik Miaelsson If the user clicks the stop button, or click another link before the previous has finished loading, or something similar an IOError exception will be raised which results in the admin being sent an email. This can understandably be pretty annoying if your users are doing that on a regular basis. So we'll trap that exception and ignore it.
author Justus Pendleton <jpend@users.sourceforge.net>
date Tue, 11 Sep 2007 21:30:14 +0000
parents d819ff1b3116
children
line wrap: on
line source

from roundup.hyperdb import String, Number, Multilink
from roundup.backends.back_bsddb import Database, Class

class config:
    DATABASE='/tmp/hyperdb_example'

db = Database(config, 'admin')
spam = Class(db, 'spam', name=String(), size=Number())
widget = Class(db, 'widget', title=String(), spam=Multilink('spam'))

oneid = spam.create(name='one', size=1)
twoid = spam.create(name='two', size=2)

widgetid = widget.create(title='a widget', spam=[oneid, twoid])

# dumb, simple query
print widget.find(spam=oneid)
print widget.history(widgetid)
print widget.search_text(

Roundup Issue Tracker: http://roundup-tracker.org/