Update TinyMCE wiget code according to r783. I hope I did it correctly this time.
http://code.google.com/p/soc/source/detail?r=783
Patch by: Pawel Solyga
Review by: to-be-reviewed
--- a/app/soc/views/helper/widgets.py Wed Oct 15 20:24:02 2008 +0000
+++ b/app/soc/views/helper/widgets.py Wed Oct 15 20:27:40 2008 +0000
@@ -61,10 +61,10 @@
{% endblock %}
"""
- mce_settings = {'mode': "exact",
- 'theme': "simple",
- 'theme_advanced_toolbar_location': "top",
- 'theme_advanced_toolbar_align': "center"}
+ DEF_MCE_SETTINGS = {'mode': "exact",
+ 'theme': "simple",
+ 'theme_advanced_toolbar_location': "top",
+ 'theme_advanced_toolbar_align': "center"}
TINY_MCE_HTML_FMT = u'''\
<textarea %(attrs)s>%(value)s</textarea>
@@ -81,7 +81,11 @@
"""
super(forms.widgets.Textarea, self).__init__(*args, **kwargs)
+ # copy the class defaults to an instance data member
+ self.mce_settings = copy.deepcopy(self.DEF_MCE_SETTINGS)
+
if mce_settings:
+ # modify the per-instance settings if called supplied customizations
self.mce_settings.update(mce_settings)
def render(self, name, value, attrs=None):