On Oct 7, 2006, at 10:08 AM, Adam Jones wrote:

>
> I have been having some trouble setting the "convert_urls" option for
> TurboTinyMCE. According to the docstring for this widget I should be
> able to pass it a mce_options parameter when it is created (or
> displayed) and have it add those options to the list. If I do so it
> wipes out all of the default entries in mce_options, which means
> TinyMCE does not start properly.
>
> Here is what I think I should be doing:
>
> sampleForm = widgets.TableForm(fields=[
>    TinyMCE(name="sample",
>                   mce_options=dict(convert_urls="false"),
>     ...
>
> I have this working for now by reaching into the TinyMCE widget and
> updating mce_options directly before I instantiate that class, but I
> don't really like that solution. Is there something I am doing wrong
> that is keeping this from working correctly?

This is a known issue. When TinyMCE was written, widgets used to make  
a copy of mutable params (lists and dicts), update the copy and place  
this copy as the instance's attribute.

However, this "magical" behavior changed a long time ago and params  
passed to the constructor override class attributes. This  
unfortunately broke TinyMCE's intended behavior but I decided to  
leave it as-is so it behaves like any other widget.

I've just released 1.0.6 to add a new parameter called "new_options"  
which behaves like "mce_options" did before. Any dict you pass as  
this parameter will update "mce_options" without discarding it's  
previous values.

Your code would look like:

sampleForm = widgets.TableForm(fields=[
    TinyMCE(name="sample",
                  #I believe jsonify.encode will take care of
                  #converting False to "false" for you
                   new_options=dict(convert_urls=False),
     ...


Regards,
Alberto


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~----------~----~----~----~------~----~------~--~---

Reply via email to