[Checkins] SVN: megrok.five/trunk/TodoList/src/todolist/app.py Update example app after changes in megrok.five. In particular, we now make use

Philipp von Weitershausen philikon at philikon.de
Wed Feb 14 19:19:19 EST 2007


Log message for revision 72591:
  Update example app after changes in megrok.five. In particular, we now make use
  of the new megrok.five.Container base class (previously Appliction was already a
  container but it's not anymore), which allows us to use dictionary spellings for
  adding, deleting objects in the container.
  

Changed:
  U   megrok.five/trunk/TodoList/src/todolist/app.py

-=-
Modified: megrok.five/trunk/TodoList/src/todolist/app.py
===================================================================
--- megrok.five/trunk/TodoList/src/todolist/app.py	2007-02-15 00:17:38 UTC (rev 72590)
+++ megrok.five/trunk/TodoList/src/todolist/app.py	2007-02-15 00:19:19 UTC (rev 72591)
@@ -3,7 +3,7 @@
 from zope import schema
 from todolist.todoitem import TodoItem
 
-class TodoList(megrok.five.Application):
+class TodoList(megrok.five.Container, grok.Application):
     pass
 
 class Index(grok.View):
@@ -18,14 +18,12 @@
     @grok.action('Add')
     def add(self, title):
         name = title.lower().replace(' ', '-')
-        name = str(name) # Zope 2 doesn't like unicode names
         item = TodoItem(name, title)
-        self.context._setObject(name, item)
+        self.context[name] = item
         self.redirect(self.url(name))
-        #self.redirect(getattr(self.context, name).absolute_url())
 
 class DeleteItem(grok.View):
 
     def render(self, name):
-        self.context.manage_delObjects([name])
+        del self.context[name]
         self.redirect(self.url(self.context))



More information about the Checkins mailing list