rendered paste bodyship/computer/browse/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 7 8 class ViewComputer(BrowserPage): 9 """Simple view class for a Computer Object""" 10 __call__ = ViewPageTemplateFile('templates/computerView.pt') 11 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 />... 36 <!--Menu Entry -> being a bitch right now.--> 37 <addMenuItem 38 title="SHIP Computer" 39 factory="ship.Computer" 40 view="ship.Computer" 41 permission="zope.ManageContent" 42 /> 43 44 <page 45 for="zope.app.container.interfaces.IAdding" 46 name="ship.Computer" 47 class=".computer.ComputerAddForm" 48 permission="zope.ManageContent" 49 /> 50...