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.form import EditForm, Fields
4 from ship.computer.interfaces import IComputer
5
6 class ViewComputer(BrowserPage):
7 """Simple view class for a Computer Object"""
8 __call__ = ViewPageTemplateFile('templates/computerView.pt')
9
10 class ComputerEditForm(EditForm):
11 """Basic EditForm for Editing Existing Computer Objects"""
12 form_fields = Fields(IComputer)
13 label = u"Edit Computer"
ship/computer/browser/configure.zcml :
1 <configure
2 xmlns="http://namespaces.zope.org/browser"
3 xmlns:zope="http://namespaces.zope.org/zope">
4
5 <!--Adapters and Security Declarations-->
6
7 <!--Browser Views-->
8 <page
9 for="ship.computer.interfaces.IComputer"
10 name="CompIndex.html"
11 class="ship.computer.browser.computer.ViewComputer"
12 permission="zope.View"
13 />
14
15 <page
16 for="ship.computer.interfaces.IComputer"
17 name="CompEdit.html"
18 class="ship.computer.browser.computer.ComputerEditForm"
19 permission="zope.ManageContent"
20 menu="zmi_views" title="Edit"
21 />
22
23 </configure>
traceback for accessing http://zopeserver/CompObj/@@CompEdit.html :
------
2007-05-22T09:34:09 ERROR SiteError http://sparky:8080/pf/@@CompEdit.html
Traceback (most recent call last):
File "/opt/Zope-3.1.1/lib/python/zope/publisher/publish.py", line 133, in publish
result = publication.callObject(request, obj)
File "/opt/Zope-3.1.1/lib/python/zope/app/publication/zopepublication.py", line 161, in callObject
return mapply(ob, request.getPositionalArguments(), request)
File "/opt/Zope-3.1.1/lib/python/zope/publisher/publish.py", line 108, in mapply
return debug_call(obj, args)
- __traceback_info__: <security proxied zope.app.publisher.browser.viewmeta.ComputerEditForm instance at 0xb5c1f1cc>
File "/opt/Zope-3.1.1/lib/python/zope/publisher/publish.py", line 114, in debug_call
return obj(*args)
File "/opt/Zope-3.1.1/lib/python/zope/formlib/form.py", line 769, in __call__
self.update()
File "/opt/Zope-3.1.1/lib/python/zope/formlib/form.py", line 732, in update
self.setUpWidgets()
File "/opt/Zope-3.1.1/lib/python/zope/formlib/form.py", line 802, in setUpWidgets
adapters=self.adapters, ignore_request=ignore_request
File "/opt/Zope-3.1.1/lib/python/zope/formlib/form.py", line 393, in setUpEditWidgets
widget = _createWidget(form_field, field, request, iface)
File "/opt/Zope-3.1.1/lib/python/zope/formlib/form.py", line 323, in _createWidget
return component.getMultiAdapter((field, request), iface)
File "/opt/Zope-3.1.1/lib/python/zope/component/_api.py", line 101, in getMultiAdapter
adapter = queryMultiAdapter(objects, interface, name, context=context)
File "/opt/Zope-3.1.1/lib/python/zope/component/_api.py", line 114, in queryMultiAdapter
return sitemanager.queryMultiAdapter(objects, interface, name, default)
File "/opt/Zope-3.1.1/lib/python/zope/component/registry.py", line 206, in queryMultiAdapter
return self.adapters.queryMultiAdapter(
File "/opt/Zope-3.1.1/lib/python/zope/interface/adapter.py", line 482, in queryMultiAdapter
result = factory(*objects)
File "/opt/Zope-3.1.1/lib/python/zope/app/component/metaconfigure.py", line 160, in __call__
return proxify(self.factory(*objects), self.checker)
File "/opt/Zope-3.1.1/lib/python/zope/app/form/browser/itemswidgets.py", line 56, in CollectionInputWidget
IInputWidget)
File "/opt/Zope-3.1.1/lib/python/zope/component/_api.py", line 103, in getMultiAdapter
raise ComponentLookupError(objects, interface, name)
ComponentLookupError: ((<zope.schema._field.List object at 0xb5c1facc>, None, <zope.publisher.browser.BrowserRequest instance URL=http://sparky:8080/pf/@@CompEdit.html>), <InterfaceClass zope.app.form.interfaces.IInputWidget>, u'')
127.0.0.1 - - [22/May/2007:09:34:09 -0230] "GET /pf/@@CompEdit.html HTTP/1.1" 500 84 "http://sparky:8080/@@contents.html" "Mozilla/5.0 (compatible; Konqueror/3.5; Linux) KHTML/3.5.4 (like Gecko)"
ship.computer.interfaces.IComputer:
24 class IComputer(Interface):
25 """Store information about a computer Object.
26 """
27
28 ipAddress = TextLine(title = u"IP Address",
29 description = u"IP Address of the Computer Object",
30 constraint = validate_ip,
31 required = True)
32
33 macAddress = TextLine(title = u"MAC Address",
34 description = u"MAC Address of the Computer Object",
35 constraint = validate_mac,
36 required = True
37 )
38
39 hostname = TextLine(title = u"Hostname",
40 description = u"Human Readable Computer Identifier",
41 default = u"none"
42 )
43
44 room = TextLine(title = u"Room Number",
45 description = u"Room where the Computer is located",
46 default = u"none"
47 )