[Checkins] SVN: zope2docs/branches/baijum-tutorial/zope2tut/examples/stage7/lms.main/src/lms/main/ form usage
Baiju M
baiju.m.mail at gmail.com
Sat Oct 10 09:09:42 EDT 2009
Log message for revision 105000:
form usage
Changed:
A zope2docs/branches/baijum-tutorial/zope2tut/examples/stage7/lms.main/src/lms/main/add_book.zpt
U zope2docs/branches/baijum-tutorial/zope2tut/examples/stage7/lms.main/src/lms/main/app.py
A zope2docs/branches/baijum-tutorial/zope2tut/examples/stage7/lms.main/src/lms/main/book.py
U zope2docs/branches/baijum-tutorial/zope2tut/examples/stage7/lms.main/src/lms/main/index_html.zpt
-=-
Added: zope2docs/branches/baijum-tutorial/zope2tut/examples/stage7/lms.main/src/lms/main/add_book.zpt
===================================================================
--- zope2docs/branches/baijum-tutorial/zope2tut/examples/stage7/lms.main/src/lms/main/add_book.zpt (rev 0)
+++ zope2docs/branches/baijum-tutorial/zope2tut/examples/stage7/lms.main/src/lms/main/add_book.zpt 2009-10-10 13:09:42 UTC (rev 105000)
@@ -0,0 +1,20 @@
+<html>
+<head>
+<title>Welcome to LMS!</title>
+</head>
+<body>
+
+<h1>Add Book</h1>
+
+ <form action="insert_book" method="POST">
+ Barcode:
+ <input type="text" name="barcode" /> <br />
+ Book Title:
+ <input type="text" name="title" /> <br />
+ Book Author:
+ <input type="text" name="author" /> <br />
+ <input type="submit" value="Add Book" />
+ </form>
+
+</body>
+</html>
Modified: zope2docs/branches/baijum-tutorial/zope2tut/examples/stage7/lms.main/src/lms/main/app.py
===================================================================
--- zope2docs/branches/baijum-tutorial/zope2tut/examples/stage7/lms.main/src/lms/main/app.py 2009-10-10 12:49:52 UTC (rev 104999)
+++ zope2docs/branches/baijum-tutorial/zope2tut/examples/stage7/lms.main/src/lms/main/app.py 2009-10-10 13:09:42 UTC (rev 105000)
@@ -1,14 +1,35 @@
from OFS.Folder import Folder
from Products.PageTemplates.PageTemplateFile import PageTemplateFile
+from lms.main.book import Book
addLmsMain_form = PageTemplateFile('addLmsMain_form', globals())
+
def addLmsMain(dispatcher, id):
"""Add LMS"""
dispatcher._setObject(id, LmsMain(id))
return "LMS Installed: %s" % id
+
class LmsMain(Folder):
+
meta_type = "LMS"
index_html = PageTemplateFile('index_html', globals())
+
+ add_book = PageTemplateFile('add_book', globals())
+
+ def insert_book(self):
+ """Insert book"""
+ request = self.REQUEST
+
+ barcode = request.form['barcode']
+ title = request.form['title']
+ author = request.form['author']
+
+ book = Book()
+ book.barcode = barcode
+ book.title = title
+ book.author = author
+ self._setObject(barcode, book)
+ return "Book added: %s" % barcode
Added: zope2docs/branches/baijum-tutorial/zope2tut/examples/stage7/lms.main/src/lms/main/book.py
===================================================================
--- zope2docs/branches/baijum-tutorial/zope2tut/examples/stage7/lms.main/src/lms/main/book.py (rev 0)
+++ zope2docs/branches/baijum-tutorial/zope2tut/examples/stage7/lms.main/src/lms/main/book.py 2009-10-10 13:09:42 UTC (rev 105000)
@@ -0,0 +1,9 @@
+from OFS.Folder import Folder
+
+class Book(Folder):
+
+ meta_type = "Book"
+
+ barcode = ""
+ title = ""
+ author = ""
Modified: zope2docs/branches/baijum-tutorial/zope2tut/examples/stage7/lms.main/src/lms/main/index_html.zpt
===================================================================
--- zope2docs/branches/baijum-tutorial/zope2tut/examples/stage7/lms.main/src/lms/main/index_html.zpt 2009-10-10 12:49:52 UTC (rev 104999)
+++ zope2docs/branches/baijum-tutorial/zope2tut/examples/stage7/lms.main/src/lms/main/index_html.zpt 2009-10-10 13:09:42 UTC (rev 105000)
@@ -6,5 +6,7 @@
<h1>Welcome to LMS!</h1>
+<a href="add_book">Add Book</a>
+
</body>
</html>
More information about the checkins
mailing list