[Checkins] SVN: z3ext.layoutform/trunk/ Add status message in edit subform

Nikolay Kim fafhrd91 at gmail.com
Sun Aug 2 16:10:39 EDT 2009


Log message for revision 102442:
  Add status message in edit subform

Changed:
  U   z3ext.layoutform/trunk/CHANGES.txt
  U   z3ext.layoutform/trunk/bootstrap.py
  U   z3ext.layoutform/trunk/setup.py
  U   z3ext.layoutform/trunk/src/z3ext/layoutform/browser/formview.py
  U   z3ext.layoutform/trunk/src/z3ext/layoutform/browser/formviewspace.pt
  U   z3ext.layoutform/trunk/src/z3ext/layoutform/browser/interfaces.py
  U   z3ext.layoutform/trunk/src/z3ext/layoutform/browser/styles.css
  U   z3ext.layoutform/trunk/src/z3ext/layoutform/edit.py
  U   z3ext.layoutform/trunk/src/z3ext/layoutform/error.py
  U   z3ext.layoutform/trunk/src/z3ext/layoutform/field.py
  U   z3ext.layoutform/trunk/src/z3ext/layoutform/form.py
  U   z3ext.layoutform/trunk/src/z3ext/layoutform/interfaces.py
  U   z3ext.layoutform/trunk/src/z3ext/layoutform/subform.py

-=-
Modified: z3ext.layoutform/trunk/CHANGES.txt
===================================================================
--- z3ext.layoutform/trunk/CHANGES.txt	2009-08-02 19:36:23 UTC (rev 102441)
+++ z3ext.layoutform/trunk/CHANGES.txt	2009-08-02 20:10:39 UTC (rev 102442)
@@ -7,6 +7,8 @@
 
 - Do not show status message for subform
 
+- Add status message in edit subform
+
 - Update tests to pass with chameleon
 
 

Modified: z3ext.layoutform/trunk/bootstrap.py
===================================================================
--- z3ext.layoutform/trunk/bootstrap.py	2009-08-02 19:36:23 UTC (rev 102441)
+++ z3ext.layoutform/trunk/bootstrap.py	2009-08-02 20:10:39 UTC (rev 102442)
@@ -51,9 +51,9 @@
 
 if is_jython:
     import subprocess
-    
-    assert subprocess.Popen([sys.executable] + ['-c', quote(cmd), '-mqNxd', 
-           quote(tmpeggs), 'zc.buildout'], 
+
+    assert subprocess.Popen([sys.executable] + ['-c', quote(cmd), '-mqNxd',
+           quote(tmpeggs), 'zc.buildout'],
            env=dict(os.environ,
                PYTHONPATH=
                ws.find(pkg_resources.Requirement.parse('setuptools')).location

Modified: z3ext.layoutform/trunk/setup.py
===================================================================
--- z3ext.layoutform/trunk/setup.py	2009-08-02 19:36:23 UTC (rev 102441)
+++ z3ext.layoutform/trunk/setup.py	2009-08-02 20:10:39 UTC (rev 102442)
@@ -51,22 +51,22 @@
       package_dir = {'':'src'},
       namespace_packages=['z3ext'],
       install_requires = ['setuptools',
-			  'zope.publisher',
-			  'zope.component',
-			  'zope.pagetemplate',
-			  'zope.app.pagetemplate',
-			  'zope.i18n',
-			  'zope.i18nmessageid',
-			  'z3c.form==1.9.0',
+                          'zope.publisher',
+                          'zope.component',
+                          'zope.pagetemplate',
+                          'zope.app.pagetemplate',
+                          'zope.i18n',
+                          'zope.i18nmessageid',
+                          'z3c.form',
                           'z3ext.layout',
                           'z3ext.resource',
-			  'z3ext.resourcepackage',
-			  'z3ext.statusmessage',
+                          'z3ext.resourcepackage',
+                          'z3ext.statusmessage',
                           ],
       extras_require = dict(test=['zope.testing',
                                   'zope.app.testing',
-				  'zope.app.zcmlfiles',
-				  'z3ext.autoinclude',]),
+                                  'zope.app.zcmlfiles',
+                                  'z3ext.autoinclude',]),
       include_package_data = True,
       zip_safe = False
       )

Modified: z3ext.layoutform/trunk/src/z3ext/layoutform/browser/formview.py
===================================================================
--- z3ext.layoutform/trunk/src/z3ext/layoutform/browser/formview.py	2009-08-02 19:36:23 UTC (rev 102441)
+++ z3ext.layoutform/trunk/src/z3ext/layoutform/browser/formview.py	2009-08-02 20:10:39 UTC (rev 102442)
@@ -11,7 +11,7 @@
 # FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
-""" 
+"""
 
 $Id:  2007-12-12 12:27:02Z fafhrd $
 """

Modified: z3ext.layoutform/trunk/src/z3ext/layoutform/browser/formviewspace.pt
===================================================================
--- z3ext.layoutform/trunk/src/z3ext/layoutform/browser/formviewspace.pt	2009-08-02 19:36:23 UTC (rev 102441)
+++ z3ext.layoutform/trunk/src/z3ext/layoutform/browser/formviewspace.pt	2009-08-02 20:10:39 UTC (rev 102442)
@@ -1,6 +1,6 @@
-<h1 class="z-form-label"
+<h1 class="z-form-label" i18n:translate=""
     tal:condition="context/label" tal:content="context/label">Do something</h1>
-<div class="z-form-description"
+<div class="z-form-description" i18n:translate=""
      tal:condition="context/description" tal:content="context/description"></div>
 
 <tal:block tal:content="structure pagelet:form.viewspaceInfo" />

Modified: z3ext.layoutform/trunk/src/z3ext/layoutform/browser/interfaces.py
===================================================================
--- z3ext.layoutform/trunk/src/z3ext/layoutform/browser/interfaces.py	2009-08-02 19:36:23 UTC (rev 102441)
+++ z3ext.layoutform/trunk/src/z3ext/layoutform/browser/interfaces.py	2009-08-02 20:10:39 UTC (rev 102442)
@@ -11,7 +11,7 @@
 # FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
-""" 
+"""
 
 $Id:  2007-12-12 12:27:02Z fafhrd $
 """

Modified: z3ext.layoutform/trunk/src/z3ext/layoutform/browser/styles.css
===================================================================
--- z3ext.layoutform/trunk/src/z3ext/layoutform/browser/styles.css	2009-08-02 19:36:23 UTC (rev 102441)
+++ z3ext.layoutform/trunk/src/z3ext/layoutform/browser/styles.css	2009-08-02 20:10:39 UTC (rev 102442)
@@ -190,4 +190,5 @@
     font-size: fontSmallSize;
     padding: 1px 1px 1px 16px;
   }
+
 }

Modified: z3ext.layoutform/trunk/src/z3ext/layoutform/edit.py
===================================================================
--- z3ext.layoutform/trunk/src/z3ext/layoutform/edit.py	2009-08-02 19:36:23 UTC (rev 102441)
+++ z3ext.layoutform/trunk/src/z3ext/layoutform/edit.py	2009-08-02 20:10:39 UTC (rev 102442)
@@ -11,7 +11,7 @@
 # FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
-""" 
+"""
 
 $Id$
 """
@@ -42,8 +42,16 @@
             if changes:
                 IStatusMessage(self.request).add(self.successMessage)
             else:
-                IStatusMessage(self.request).add(self.noChangesMessage)
+                changed = False
+                for subform in self.subforms:
+                    if subform.changesApplied:
+                        IStatusMessage(self.request).add(self.successMessage)
+                        self.changed = True
+                        break
 
+                if not changed:
+                    IStatusMessage(self.request).add(self.noChangesMessage)
+
             nextURL = self.nextURL()
             if nextURL:
                 self.redirect(nextURL)

Modified: z3ext.layoutform/trunk/src/z3ext/layoutform/error.py
===================================================================
--- z3ext.layoutform/trunk/src/z3ext/layoutform/error.py	2009-08-02 19:36:23 UTC (rev 102441)
+++ z3ext.layoutform/trunk/src/z3ext/layoutform/error.py	2009-08-02 20:10:39 UTC (rev 102442)
@@ -11,7 +11,7 @@
 # FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
-""" 
+"""
 
 $Id:  2007-12-12 12:27:02Z fafhrd $
 """
@@ -31,6 +31,6 @@
 
     def render(self, message):
         self.message = message[0]
-        self.errors = [err for err in message[1:] 
+        self.errors = [err for err in message[1:]
                        if IErrorViewSnippet.providedBy(err) and err.widget is None]
         return self.index()

Modified: z3ext.layoutform/trunk/src/z3ext/layoutform/field.py
===================================================================
--- z3ext.layoutform/trunk/src/z3ext/layoutform/field.py	2009-08-02 19:36:23 UTC (rev 102441)
+++ z3ext.layoutform/trunk/src/z3ext/layoutform/field.py	2009-08-02 20:10:39 UTC (rev 102442)
@@ -11,7 +11,7 @@
 # FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
-""" 
+"""
 
 $Id$
 """

Modified: z3ext.layoutform/trunk/src/z3ext/layoutform/form.py
===================================================================
--- z3ext.layoutform/trunk/src/z3ext/layoutform/form.py	2009-08-02 19:36:23 UTC (rev 102441)
+++ z3ext.layoutform/trunk/src/z3ext/layoutform/form.py	2009-08-02 20:10:39 UTC (rev 102442)
@@ -78,6 +78,8 @@
     render = PageletBaseForm.render
     __call__ = PageletBaseForm.__call__
 
+    successMessage = _('Data successfully updated.')
+    noChangesMessage = _('No changes were applied.')
     formErrorsMessage = _(u'Please fix indicated errors.')
 
     def extractData(self):
@@ -97,7 +99,7 @@
 
     def _loadSubforms(self):
         return [(name, form) for name, form in
-                getAdapters((self.context, self, self.request), IPageletSubform)]
+                getAdapters((self.context,self,self.request), IPageletSubform)]
 
     def updateForms(self):
         wrapped = IFormWrapper.providedBy(self)

Modified: z3ext.layoutform/trunk/src/z3ext/layoutform/interfaces.py
===================================================================
--- z3ext.layoutform/trunk/src/z3ext/layoutform/interfaces.py	2009-08-02 19:36:23 UTC (rev 102441)
+++ z3ext.layoutform/trunk/src/z3ext/layoutform/interfaces.py	2009-08-02 20:10:39 UTC (rev 102442)
@@ -58,6 +58,8 @@
     subforms = interface.Attribute('Ordered list of managed subforms')
     views = interface.Attribute('Ordered list of managed views')
 
+    successMessage = interface.Attribute('Success message')
+    noChangesMessage = interface.Attribute('No changes message')
     formErrorsMessage = interface.Attribute('Error message')
 
     def updateForms():
@@ -93,6 +95,8 @@
 class IPageletEditSubForm(IPageletBaseForm):
     """ Sub form mixin for pagelet implementation."""
 
+    changesApplied = interface.Attribute('Changes applied')
+
     def executeActions(form):
         """Execute form actions."""
 

Modified: z3ext.layoutform/trunk/src/z3ext/layoutform/subform.py
===================================================================
--- z3ext.layoutform/trunk/src/z3ext/layoutform/subform.py	2009-08-02 19:36:23 UTC (rev 102441)
+++ z3ext.layoutform/trunk/src/z3ext/layoutform/subform.py	2009-08-02 20:10:39 UTC (rev 102442)
@@ -11,7 +11,7 @@
 # FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
-""" 
+"""
 
 $Id:  2007-12-12 12:27:02Z fafhrd $
 """
@@ -23,6 +23,8 @@
 from z3c.form import subform, button
 from z3c.form.interfaces import ISubForm, IActionHandler
 
+from z3ext.statusmessage.interfaces import IStatusMessage
+
 from utils import applyChanges
 from form import PageletBaseForm
 from interfaces import _, IPageletEditSubForm, IPageletSubform, ISaveAction
@@ -33,6 +35,7 @@
 
     label = u''
     description = u''
+    changesApplied = False
 
     render = PageletBaseForm.render
     __call__ = PageletBaseForm.__call__
@@ -54,6 +57,7 @@
                 for interface, names in changes.items():
                     descriptions.append(Attributes(interface, *names))
 
+                self.changesApplied = True
                 event.notify(
                     ObjectModifiedEvent(self.getContent(), *descriptions))
 



More information about the Checkins mailing list