hi guys,
i am working with the code on chapter 5....i even copy and pasted the
code from turbogears add code as follows:
@expose()
@turbogears.error_handler(Bookmark)
@turbogears.validate(form=bookmark_form)
def save_bookmark(self, *args, **kwargs):
try:
b=model.Bookmark.get(id)
b.bookmarkName=kwargs["bookmarkName"]
b.link = kwargs["link"]
b.description = kwargs["description"]
model.Bookmark.UpdateCategories(b,kwargs["select_categories"])
except:
b=model.Bookmark(bookmarkName=kwargs["bookmarkName"], link
= kwargs["link"], description = kwargs["description"])
for item in kwargs["select_categories"]:
b.addCategories(model.Categories.get(item))
raise redirect("/list")
@expose(template="wiki20.templates.form")
def bookmark(self, *args, **kwargs):
if args and args[0] == "add":
values = []
submit_action= "/save_bookmark/"
if args and args[0] == "edit":
try:
b = model.Bookmark.get(args[1])
default_options = []
for a in b.categories:
default_options.append(a.id)
values = {"bookmarkName" : b.bookmarkName, "link":
b.link, "description": b.description, "select_categories":
default_options}
except SQLObjectNotFound:
values = ""
turbogears.flash = "That's not a valid Bookmark, do
you want to add one now?"
submit_action = "/save_bookmark/edit/%s" %args[1]
return dict(form=bookmark_form, values=values,
action=submit_action)
but iam stuck with 2 errors...when i try to add a new bookmark it is
gives me a TYPEERROR: arg is not a python function.....and when i try
to edit i get an INTEGRITY ERROR: IntegrityError: column
bookmark_name is not unique!! Does anyone know whats wrong with the
code?? and its very similar to one on the website
cheers
dev :
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---