[Zope3-checkins] CVS: Zope3/src/zope/app/rotterdam - configure.zcml:1.4 editingwidgets.py:1.2

Garrett Smith garrett at mojave-corp.com
Fri Mar 5 23:17:56 EST 2004


Update of /cvs-repository/Zope3/src/zope/app/rotterdam
In directory cvs.zope.org:/tmp/cvs-serv15646/src/zope/app/rotterdam

Modified Files:
	configure.zcml editingwidgets.py 
Log Message:
Merged changes from garrett-widgets2-branch:

- Changed the way widgets are looked up to use interfaces instead of 
  names.
  
- Refactor of zope/app/form/utility.py -- see 

    http://dev.zope.org/Zope3/WidgetsAndMultiwayAdapters
    
  for details.
  
- Moved configuration of vocab widgets to its own zcml file
  (zope/app/browser/form/vocabularywidget.zcml).

- Removed 'propertyNames' and 'getValue' from widgets. This  is replaced
  by accessing the widget attributes directly.
  
- Deleted depreated methods from widget interface: haveData and getData.


=== Zope3/src/zope/app/rotterdam/configure.zcml 1.3 => 1.4 ===
--- Zope3/src/zope/app/rotterdam/configure.zcml:1.3	Wed Mar  3 05:38:50 2004
+++ Zope3/src/zope/app/rotterdam/configure.zcml	Fri Mar  5 23:17:26 2004
@@ -89,14 +89,14 @@
       layer="rotterdam"
       template="navigation_macros.pt"
       />
- 
-  <browser:page
-      permission="zope.Public"
-      allowed_interface="zope.app.browser.interfaces.form.IBrowserWidget"
+
+  <view
+      type="zope.publisher.interfaces.browser.IBrowserRequest"
       for="zope.schema.interfaces.ISourceText"
-      name="edit"
+      provides="zope.app.interfaces.form.IInputWidget"
+      factory=".editingwidgets.SimpleEditingWidget"
+      permission="zope.Public"
       layer="rotterdam"
-      class=".editingwidgets.SimpleEditingWidget" 
       />
 
 </configure>


=== Zope3/src/zope/app/rotterdam/editingwidgets.py 1.1 => 1.2 ===
--- Zope3/src/zope/app/rotterdam/editingwidgets.py:1.1	Tue Mar  2 12:11:30 2004
+++ Zope3/src/zope/app/rotterdam/editingwidgets.py	Fri Mar  5 23:17:26 2004
@@ -16,12 +16,15 @@
 """
 __metaclass__ = type
 
+from zope.interface import implements
+from zope.app.interfaces.form import IInputWidget
 from zope.app.browser.form.widget import BrowserWidget, renderElement
 from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile
 
 class SimpleEditingWidget(BrowserWidget):
     """Improved textarea editing, with async saving using JavaScript."""
-    propertyNames = BrowserWidget.propertyNames + ['width', 'height', 'extra']
+
+    implements(IInputWidget)
 
     default = ""
     width = 60
@@ -38,24 +41,16 @@
 
     def __call__(self):
         return renderElement("textarea",
-                             name = self.name,
-                             id = self.name,
-                             cssClass = self.getValue('cssClass'),
-                             rows = self.getValue('height'),
-                             cols = self.getValue('width'),
-                             style = self.style,
-                             contents = self._showData(),
-                             extra = self.getValue('extra'))
+                             name=self.name,
+                             id=self.name,
+                             cssClass=self.cssClass,
+                             rows=self.height,
+                             cols=self.width,
+                             style=self.style,
+                             contents=self._showData(),
+                             extra=self.extra)
 
     def contents(self):
         """Make the contents available to the template"""
         return self._showData()
 
-    # XXX: This is ridiculous! This cannot work in any browser well!
-    #def row(self):
-    #    # XXX This was originally set to make a colspan=2 table cell, and
-    #    #     have the label above the text area. Perhaps we should use
-    #    #     different div classes for this case?
-    #    return self.rowTemplate()
-    #    return '<h1>here</h1><div class="label">%s</div><div class="field">%s</div>' % (
-    #            self.label(), self())




More information about the Zope3-Checkins mailing list