Here is what I got
In the body for master.ked from which all the users.kid gets derived
has the following
<div py:if="tg_flash" class="flash" py:content="tg_flash"></div>
<div py:replace="[item.text]+item[:]"/>
-----------------------------------------------------------------
class Users:
@expose(template="tutorial.templates.users")
def index(self):
users = model.User.select()
return dict(users=users)
@expose(template="tutorial.templates.user")
def add(self, auser):
auser = auser.strip()
auser = auser.replace('\x00', '')
auser = auser.encode('utf-8')
if auser:
try:
user = model.User.byUser(auser)
except model.SQLObjectNotFound:
oUser = model.User(user=auser)
flash("User %s added!" % auser)
else:
print("User %s already exists!" % auser)
else:
print("User must be non-empty!")
raise cherrypy.HTTPRedirect('index')
-----------------------------------------------
class User(SQLObject):
user = StringCol(length=100,alternateID=True)
-----------------------------------------------
Page handler: <bound method Users.add of
<tutorial.controllers.Usersinstance at 0xb6cebb4c>>
Traceback (most recent call last):
File "/home/local_linux/lib/python2.4/site-packages/CherryPy-
2.2.1-py2.4.egg/cherrypy/_cphttptools.py", line 105, in _run
self.main()
File "/home/local_linux/lib/python2.4/site-packages/CherryPy-
2.2.1-py2.4.egg/cherrypy/_cphttptools.py", line 254, in main
body = page_handler(*virtual_path, **self.params)
File "<string>", line 3, in add
File "/home/local_linux/lib/python2.4/site-packages/TurboGears-
1.0-py2.4.egg/turbogears/controllers.py", line 334, in expose
output = database.run_with_transaction(
File "<string>", line 5, in run_with_transaction
File "/home/local_linux/lib/python2.4/site-packages/TurboGears-
1.0-py2.4.egg/turbogears/database.py", line 260, in so_rwt
retval = func(*args, **kw)
File "<string>", line 5, in _expose
File "/home/local_linux/lib/python2.4/site-packages/TurboGears-
1.0-py2.4.egg/turbogears/controllers.py", line 351, in <lambda>
mapping, fragment, args, kw)))
File "/home/local_linux/lib/python2.4/site-packages/TurboGears-
1.0-py2.4.egg/turbogears/controllers.py", line 378, in _execute_func
output = errorhandling.try_call(func, *args, **kw)
File "/home/local_linux/lib/python2.4/site-packages/TurboGears-
1.0-py2.4.egg/turbogears/errorhandling.py", line 73, in try_call
return func(self, *args, **kw)
File
"/home/ma2/raju/turbogear/tutorial1/tutorial/tutorial/controllers.py", line
53, in add
flash("User %s added!" % nuser)
NameError: global name 'flash' is not defined
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss