rendered paste bodyship/computer/browser/computer.py: 1 from zope.publisher.browser import BrowserPage 2 from zope.app.pagetemplate import ViewPageTemplateFile 3 from zope.formlib.namedtemplate import NamedTemplate,NamedTemplateImplementation 4 from zope.formlib.form import EditForm, Fields, AddForm, applyChanges 5 from zope.component import createObject 6 from ship.computer.interfaces import IComputer... 12 class ComputerEditForm(EditForm): 13 """Basic EditForm for Editing Existing Computer Objects""" 14 form_fields = Fields(IComputer) 15 label = u"Edit Computer" 16 17 class ComputerAddForm(AddForm): 18 """Basic AddForm for adding new Computer Objects with user specified data""" 19 form_fields = Fields(IComputer) 20 label = u"Add Computer" 21 22 template = NamedTemplate('computer.addform') 23 24 def create(self, data): 25 computer = createObject(u"ship.Computer") 26 applyChanges(computer, self.form_fields, data) 27 return computer 28 29 form_template = NamedTemplateImplementation( 30 ViewPageTemplateFile('templates/compForm.pt'))ship/computer/browser/configure.zcml:... 5 <!--Adapters and Security Declarations--> 6 <zope:adapter 7 factory=".computer.form_template" 8 for=".computer.ComputerAddForm" 9 name="computer.addform" 10 />... 21 <page 22 for="ship.computer.interfaces.IComputer" 23 name="CompEdit.html" 24 class="ship.computer.browser.computer.ComputerEditForm" 25 permission="zope.ManageContent" 26 menu="zmi_views" title="Edit" 27 /> 28 29 <!--Menu Entry--> 30 <addMenuItem 31 title="SHIP Computer" 32 factory="ship.Computer" 33 view="ship.Computer" 34 permission="zope.ManageContent" 35 /> 36 37 <page 38 for="zope.app.container.interfaces.IAdding" 39 name="ship.Computer" 40 class=".computer.ComputerAddForm" 41 permission="zope.ManageContent" 42 />...