[Zope3-checkins] CVS: Zope3/src/zope/app/browser/services - service.py:1.6 field.py:1.6 connection.py:1.4 cache.py:1.3 adapter.py:1.6

Albertas Agejevas alga@codeworks.lt
Fri, 21 Feb 2003 09:54:05 -0500


Update of /cvs-repository/Zope3/src/zope/app/browser/services
In directory cvs.zope.org:/tmp/cvs-serv25770/app/browser/services

Modified Files:
	service.py field.py connection.py cache.py adapter.py 
Log Message:
Changed the browser:editform to clear the values which are missing or
empty in the form by default.

Added a keyword argument set_missing to getWidgetsData() and
getWidgetsDataForContent().

Renamed a keyword argument required there to strict, which is
clearer.  Added it everywhere to be more explicit.


=== Zope3/src/zope/app/browser/services/service.py 1.5 => 1.6 ===
--- Zope3/src/zope/app/browser/services/service.py:1.5	Mon Feb  3 14:01:21 2003
+++ Zope3/src/zope/app/browser/services/service.py	Fri Feb 21 09:53:34 2003
@@ -142,5 +142,5 @@
     def action(self, service_type, component_path):
         sd = ServiceConfiguration(service_type, component_path)
         sd = self.context.add(sd)
-        getWidgetsDataForContent(self, IConfiguration, sd)
+        getWidgetsDataForContent(self, IConfiguration, sd, strict=False)
         self.request.response.redirect(self.context.nextURL())


=== Zope3/src/zope/app/browser/services/field.py 1.5 => 1.6 ===
--- Zope3/src/zope/app/browser/services/field.py:1.5	Thu Jan 16 14:50:32 2003
+++ Zope3/src/zope/app/browser/services/field.py	Fri Feb 21 09:53:34 2003
@@ -27,6 +27,13 @@
 
 class ComponentPathWidget(BrowserWidget):
 
+    def haveData(self):
+        value = self.request.form.get(self.name, None)
+        if not value:
+            return False
+        else:
+            return super(ComponentPathWidget, self).haveData()
+
     def _convert(self, value):
         return value or None
 


=== Zope3/src/zope/app/browser/services/connection.py 1.3 => 1.4 ===
--- Zope3/src/zope/app/browser/services/connection.py:1.3	Tue Dec 31 08:15:37 2002
+++ Zope3/src/zope/app/browser/services/connection.py	Fri Feb 21 09:53:34 2003
@@ -44,5 +44,6 @@
             raise ValueError('You must specify a component path')
         cd = ConnectionConfiguration(connection_name, component_path)
         cd = self.context.add(cd)
-        getWidgetsDataForContent(self, IConnectionConfiguration, content=cd)
+        getWidgetsDataForContent(self, IConnectionConfiguration, content=cd,
+                                 strict=False)
         self.request.response.redirect(self.context.nextURL())


=== Zope3/src/zope/app/browser/services/cache.py 1.2 => 1.3 ===
--- Zope3/src/zope/app/browser/services/cache.py:1.2	Wed Dec 25 09:12:36 2002
+++ Zope3/src/zope/app/browser/services/cache.py	Fri Feb 21 09:53:34 2003
@@ -43,5 +43,6 @@
             raise ValueError, 'You must specify a cache name'
         cd = CacheConfiguration(cache_name, component_path)
         cd = self.context.add(cd)
-        getWidgetsDataForContent(self, ICacheConfiguration, content=cd)
+        getWidgetsDataForContent(self, ICacheConfiguration, content=cd,
+                                 strict=False)
         self.request.response.redirect(self.context.nextURL())


=== Zope3/src/zope/app/browser/services/adapter.py 1.5 => 1.6 ===
--- Zope3/src/zope/app/browser/services/adapter.py:1.5	Mon Jan 27 21:56:41 2003
+++ Zope3/src/zope/app/browser/services/adapter.py	Fri Feb 21 09:53:34 2003
@@ -96,11 +96,12 @@
 
     def refresh(self):
         if "FINISH" in self.request:
-            data = getWidgetsData(self, IAdapterConfigurationInfo)
+            data = getWidgetsData(self, IAdapterConfigurationInfo, strict=True)
             configuration = AdapterConfiguration(**data)
             publish(self.context.context, ObjectCreatedEvent(configuration))
             configuration = self.context.add(configuration)
-            getWidgetsDataForContent(self, IConfiguration, configuration)
+            getWidgetsDataForContent(self, IConfiguration, configuration,
+                                     strict=False)
             self.request.response.redirect(self.context.nextURL())
             return False