[Checkins] SVN: megrok.five/trunk/TodoList/ Example app for megrok.five. It (almost) works, only computing urls is a bit flaky.

Philipp von Weitershausen philikon at philikon.de
Wed Feb 7 22:26:24 EST 2007


Log message for revision 72441:
  Example app for megrok.five.  It (almost) works, only computing urls is a bit flaky.
  

Changed:
  A   megrok.five/trunk/TodoList/
  A   megrok.five/trunk/TodoList/setup.py
  A   megrok.five/trunk/TodoList/src/
  A   megrok.five/trunk/TodoList/src/todolist/
  A   megrok.five/trunk/TodoList/src/todolist/__init__.py
  A   megrok.five/trunk/TodoList/src/todolist/app.py
  A   megrok.five/trunk/TodoList/src/todolist/app_templates/
  A   megrok.five/trunk/TodoList/src/todolist/app_templates/index.pt
  A   megrok.five/trunk/TodoList/src/todolist/configure.zcml
  A   megrok.five/trunk/TodoList/src/todolist/todoitem.py
  A   megrok.five/trunk/TodoList/src/todolist/todoitem_templates/
  A   megrok.five/trunk/TodoList/src/todolist/todoitem_templates/index.pt

-=-
Added: megrok.five/trunk/TodoList/setup.py
===================================================================
--- megrok.five/trunk/TodoList/setup.py	2007-02-08 03:24:16 UTC (rev 72440)
+++ megrok.five/trunk/TodoList/setup.py	2007-02-08 03:26:23 UTC (rev 72441)
@@ -0,0 +1,13 @@
+from setuptools import setup, find_packages
+
+version = 0.1
+
+setup(name='TodoList',
+      version=version,
+      package_dir={'': 'src'},
+      packages=find_packages('src'),
+      include_package_data=True,
+      zip_safe=False,
+      install_requires=['grok',
+                        'megrok.five'],
+      )


Property changes on: megrok.five/trunk/TodoList/setup.py
___________________________________________________________________
Name: svn:eol-style
   + native

Added: megrok.five/trunk/TodoList/src/todolist/__init__.py
===================================================================
--- megrok.five/trunk/TodoList/src/todolist/__init__.py	2007-02-08 03:24:16 UTC (rev 72440)
+++ megrok.five/trunk/TodoList/src/todolist/__init__.py	2007-02-08 03:26:23 UTC (rev 72441)
@@ -0,0 +1 @@
+# make this directory a package


Property changes on: megrok.five/trunk/TodoList/src/todolist/__init__.py
___________________________________________________________________
Name: svn:eol-style
   + native

Added: megrok.five/trunk/TodoList/src/todolist/app.py
===================================================================
--- megrok.five/trunk/TodoList/src/todolist/app.py	2007-02-08 03:24:16 UTC (rev 72440)
+++ megrok.five/trunk/TodoList/src/todolist/app.py	2007-02-08 03:26:23 UTC (rev 72441)
@@ -0,0 +1,31 @@
+import grok
+import megrok.five
+from zope import schema
+from todolist.todoitem import TodoItem
+
+class TodoList(megrok.five.Application):
+    pass
+
+class Index(grok.View):
+    pass
+
+class AddTodoItem(grok.AddForm):
+
+    form_fields = grok.Fields(
+        title = schema.TextLine(title=u'Title')
+        )
+
+    @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.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])
+        self.redirect(self.url(self.context))


Property changes on: megrok.five/trunk/TodoList/src/todolist/app.py
___________________________________________________________________
Name: svn:eol-style
   + native

Added: megrok.five/trunk/TodoList/src/todolist/app_templates/index.pt
===================================================================
--- megrok.five/trunk/TodoList/src/todolist/app_templates/index.pt	2007-02-08 03:24:16 UTC (rev 72440)
+++ megrok.five/trunk/TodoList/src/todolist/app_templates/index.pt	2007-02-08 03:26:23 UTC (rev 72441)
@@ -0,0 +1,21 @@
+<html>
+<body>
+
+<h1>Todo List</h1>
+
+<ul>
+  <li tal:repeat="item context/objectValues">
+    <a href=""
+       tal:attributes="href python:view.url(item)"
+       tal:content="item/title">todo item title goes here
+    </a>
+    [<a href="" tal:attributes="href python:view.url('deleteitem')+'?name=' + item.__name__">delete</a>]
+  </li>
+</ul>
+
+<p><a href="" tal:attributes="href python:view.url('addtodoitem')">
+    Add Todo Item
+</a></p>
+
+</body>
+</html>


Property changes on: megrok.five/trunk/TodoList/src/todolist/app_templates/index.pt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: megrok.five/trunk/TodoList/src/todolist/configure.zcml
===================================================================
--- megrok.five/trunk/TodoList/src/todolist/configure.zcml	2007-02-08 03:24:16 UTC (rev 72440)
+++ megrok.five/trunk/TodoList/src/todolist/configure.zcml	2007-02-08 03:26:23 UTC (rev 72441)
@@ -0,0 +1 @@
+<grok package="." xmlns="http://namespaces.zope.org/grok" />
\ No newline at end of file


Property changes on: megrok.five/trunk/TodoList/src/todolist/configure.zcml
___________________________________________________________________
Name: svn:eol-style
   + native

Added: megrok.five/trunk/TodoList/src/todolist/todoitem.py
===================================================================
--- megrok.five/trunk/TodoList/src/todolist/todoitem.py	2007-02-08 03:24:16 UTC (rev 72440)
+++ megrok.five/trunk/TodoList/src/todolist/todoitem.py	2007-02-08 03:26:23 UTC (rev 72441)
@@ -0,0 +1,23 @@
+import grok
+import megrok.five
+from zope import schema
+
+class TodoItem(megrok.five.Model):
+
+    def __init__(self, id, title):
+        self.id = id
+        self.title = title
+
+class Index(grok.View):
+    pass
+
+class Edit(grok.EditForm):
+
+    form_fields = grok.Fields(
+        title = schema.TextLine(title=u'Title')
+        )
+
+    @grok.action('Save')
+    def save(self, title):
+        self.applyChanges(title=title)
+        self.redirect(self.url(self.context))


Property changes on: megrok.five/trunk/TodoList/src/todolist/todoitem.py
___________________________________________________________________
Name: svn:eol-style
   + native

Added: megrok.five/trunk/TodoList/src/todolist/todoitem_templates/index.pt
===================================================================
--- megrok.five/trunk/TodoList/src/todolist/todoitem_templates/index.pt	2007-02-08 03:24:16 UTC (rev 72440)
+++ megrok.five/trunk/TodoList/src/todolist/todoitem_templates/index.pt	2007-02-08 03:26:23 UTC (rev 72441)
@@ -0,0 +1,13 @@
+<html>
+<body>
+
+<h1 tal:content="context/title">todo item title goes here</h1>
+
+<p><a href="" tal:attributes="href python:view.url(context.aq_parent)">
+    Back to main page
+</a></p>
+
+<p><a tal:attributes="href python:view.url('edit')">Edit</a></p>
+
+</body>
+</html>


Property changes on: megrok.five/trunk/TodoList/src/todolist/todoitem_templates/index.pt
___________________________________________________________________
Name: svn:eol-style
   + native



More information about the Checkins mailing list