view scripts/hyperdb_example.py @ 3898:dd00c917fc40

per-tracker 404 templating Currently if CGI can't map a name it raises NotFound which gets propagated up to roundup-server which generates a plain vanilla 404 page. This changes it so that the CGI client tries to handle NotFound itself by rendering the appropriate template: classname.404.html (or _generic.404.html if no class specific one is found). If the URL can't be mapped to a DB class then we just reraise NotFound and let the upper layer take care of it. Also, add some basic templates for it. They aren't pretty but no worse than what you got before and provide a jumping off point for further customization. This should fix [SF#403287].
author Justus Pendleton <jpend@users.sourceforge.net>
date Wed, 12 Sep 2007 01:15:07 +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/