r252746 - plone.app.headeranimation/trunk/plone/app/headeranimation/browser

"Mikko Ohtamaa" <svn-changes-z4DKO/[email protected]> Fri, 14 Feb 2014 00:10:54 +0000 (UTC)
Newsgroups gmane.comp.web.zope.plone.collective.cvs
Message-ID <[email protected]>
Author: miohtama
Date: Fri Feb 14 00:10:54 2014
New Revision: 252746

Modified:
   plone.app.headeranimation/trunk/plone/app/headeranimation/browser/forms.py
Log:
saariselka.com header animation treklife fix

Modified: plone.app.headeranimation/trunk/plone/app/headeranimation/browser/forms.py
==============================================================================
--- plone.app.headeranimation/trunk/plone/app/headeranimation/browser/forms.py	(original)
+++ plone.app.headeranimation/trunk/plone/app/headeranimation/browser/forms.py	Fri Feb 14 00:10:54 2014
@@ -74,7 +74,7 @@
     def __init__(self, context, request):
         FormWrapper.__init__(self, context, request)
         self.header_animation_helper = self.context.unrestrictedTraverse("@@header_animation_helper")
-             
+
     def getAnimationCount(self):
         """ Return how many animations are availabe in the context """
         if self.header_animation_helper.header:
@@ -85,21 +85,21 @@
     def getHeaderDefiner(self):
         """ Return the parent object defining animations in this context """
         parent = self.header_animation_helper.getDefiningContext()
-        
+
         if parent == None:
             # Do not cause exception in the templates
-            return self.context 
-        
+            return self.context
+
         return parent
 
-    def __call__(self):        
+    def __call__(self):
         self.header_animation_helper.solve()
-        return FormWrapper.__call__(self)   
+        return FormWrapper.__call__(self)
 
 class EditHeaderAnimationSubForm(crud.EditSubForm):
     """ One row in EditHeaderAnimationForm
     """
-    
+
     def applyChanges(self, data):
 
         changes = crud.EditSubForm.applyChanges(self, data)
@@ -145,7 +145,7 @@
 
         self.update_download_urls()
 
-# Do not mix with Products.Five.browser.pagetemplatefile.ViewPageTemplateFile 
+# Do not mix with Products.Five.browser.pagetemplatefile.ViewPageTemplateFile
 from zope.app.pagetemplate import ViewPageTemplateFile as Zope3PageTemplateFile
 
 class AddHeaderAnimationForm(crud.AddForm):
@@ -159,7 +159,7 @@
 
 class EditHeaderAnimationForm(crud.EditForm):
     """ Editable table of rows where each row presentes HeaderAnimation object """
-    
+
     # zope.interface.implements(ISubForm)
 
     label = u"Existing header uploads"
@@ -216,7 +216,9 @@
 
         """
 
-        alternatives = self.getContent().alternatives
+        behavior = IHeaderBehavior(self.context)
+
+        alternatives = behavior.alternatives
 
         new_object = HeaderAnimation()
 
@@ -242,6 +244,8 @@
         # is serialized at the end of this transaction
         alternatives._p_changed = True
 
+        behavior.save()
+
         return new_object
 
     def remove(self, (id, item)):
@@ -261,11 +265,11 @@
         import zope.interface
         from plone.z3cform.interfaces import IWrappedForm
 
-        zope.interface.alsoProvides(addform, IWrappedForm)        
+        zope.interface.alsoProvides(addform, IWrappedForm)
         addform.update()
         editform.update()
         self.subforms = [editform, addform]
-        
+
 
 
 # The browser page which renders the form

------------------------------------------------------------------------------
Android apps run on BlackBerry 10
Introducing the new BlackBerry 10.2.1 Runtime for Android apps.
Now with support for Jelly Bean, Bluetooth, Mapview and more.
Get your Android app in front of a whole new audience.  Start now.
http://pubads.g.doubleclick.net/gampad/clk?id=124407151&iu=/4140/ostg.clktrk