Struggling with CherryPy and Genshi
by Joe Tseng other posts by this author
Apr 10 2008 6:17AM messages near this date
view in the new Beta List Site
Re: Shelve bug in ActiveState Python? [or Python as Houdini]
|
RE: Struggling with CherryPy and Genshi
I'm still a very pythonically green newbie (since last Tuesday) so this issue may be obvious
to someone else. I'm trying to get a CherryPy/Genshi-based web app to display the contents
of a list object being passed to a template but it's not playing nice. I was able to verif
y in the shell the list was properly created and the methods and properties behaved as desig
ned. Now I'm trying to pass the object to the template:
====================
[model.py]
class Run(object)
...
class Runlist(list)
...
[controller.py]
loader = TemplateLoader( os.path.join(os.path.dirname(__file__), "templates"), auto_re
load=True)
...
runlist = Runlist()
...
class Root(object)
def __init__(self, runlist):
self.runlist = runlist
@cherrypy.expose
def index(self)
tmpl = loader.load("index.html")
stream = tmpl.generate(runlist)
return stream.render("html", doctype="html")
====================
The code above returns an "AssertionError" message.
If I try to serialize the object:
====================
@cherrypy.expose def index(self):
tmpl = loader.load("index.html") data = pickle.load(runlist) stream = tmpl.g
enerate(data) return stream.render("html", doctype="html")
====================
I get the following:
AttributeError: 'Runlist' object has no attribute 'readline'
I hope someone can help me out of this muck...
- Joe
_________________________________________________________________
More immediate than e-mail? Get instant access with Windows Live Messenger.
http://www.windowslive.com/messenger/overview.html?ocid=TXT_TAGLM_WL_Refresh_instantaccess_0
42008
Thread:
Joe Tseng
Joe Tseng
|