Opened 6 years ago

Closed 6 years ago

#3922 closed defect (fixed)

coercing to Unicode: need string or buffer, tuple found

Reported by: anonymous Owned by: lcordier
Priority: normal Component: FreemindMacro
Severity: normal Keywords:
Cc: Trac Release: 0.11



I installed the FreeMindMacro, however when I am trying to call a file embedded in a wiki page I get the following:

Error: Macro Freemind(wiki://WikiPageName/ failed

coercing to Unicode: need string or buffer, tuple found


Attachments (0)

Change History (4)

comment:1 Changed 6 years ago by anonymous

Ah I see between version 4500 and 4514 in SVN that you introduced the usage of the string_args unicode to string keys. I believe that might be giving me the problem. I don't know if it makes a difference or not but I'm on Python 2.4 on RHEL5.


    diff U11i
    old new  
    8989    return result 
    9292class FreemindMacro(WikiMacroBase): 
    9494    implements(IWikiMacroProvider, ITemplateProvider) 
    9696    # IWikiMacroProvider methods 
    9797    def expand_macro(self, formatter, name, content): 
    9898        args, kwargs = parse_args(content, strict=False) 
     99        kwargs = string_keys(kwargs) 
    100101        if len(args) >= 1: 
    101102            url = args[0] 
    102103        elif len(args) == 0: 
    103104            raise TracError('URL to the mindmap at least required.') 
    105106        embed_count = getattr(formatter, EMBED_COUNT, 0) 
    106107        embed_count += 1 
    107108        setattr(formatter, EMBED_COUNT, embed_count) 
    109110        if embed_count == 1: 
    142143                //fo.addVariable("unfoldAll","true"); 
    143144                fo.write("flashcontent%(count)02d"); 
    144145            }); 
    145146        ''' % { 
    146147            'count': embed_count, 
    147148            'visor': get_absolute_url(formatter.href.base, 'htdocs://freemind/swf/visorFreemind.swf'), 
    148149            'file': url, 
    149150            'base': base, 
    150151            'css': get_absolute_url(formatter.href.base, 'htdocs://freemind/css/flashfreemind.css'), 
    151152        } 
    153         kwargs = string_keys(kwargs) 
    154154        style_dict = xform_style(kwargs.get('style', '')) 
    156156        width = kwargs.pop('width', style_dict.get('width', '800px')) 
    157157        height = kwargs.pop('height', style_dict.get('height', '600px')) 
    159159        style_dict['border'] = style_dict.get('border', '1px solid #cccccc;') 
    160160        style_dict['margin'] = style_dict.get('margin', '0 auto') 
    161161        style_dict['width'] = width 
    162162        style_dict['height'] = height 
    164164        kwargs['style'] = xform_style(style_dict) 

comment:2 Changed 6 years ago by anonymous

As you can see in the diff I only moved the position of kwargs = string_keys(kwargs).
In [4520] I have updated that parsing to strict=True, this will only affect you if you had '=' signs in you url. I cannot replicate your error, but I added debug code to the sting_keys(kwargs) call. If the problem still persist, please paste the error output so that I have more information to go on.

From the ticket description you have
Error: Macro Freemind(wiki://WikiPageName/ failed
am I correct in assuming that you have a wiki-page named WikiPageName and you actually attached a file named to that page ?

comment:3 Changed 6 years ago by anonymous

Thanks for the help so far. I do have the wiki page and the mind map names as above. Here is my debug log output after using your latest version of the macro.

2008-10-20 08:37:35,533 Trac[formatter] DEBUG: Executing Wiki macro Freemind by provider <freemind.macro.FreemindMacro object at 0xb79bd3ac>
2008-10-20 08:37:35,535 Trac[formatter] ERROR: Macro Freemind(wiki://GemsBmcUsage/ failed
Traceback (most recent call last):

File "/usr/lib/python2.4/site-packages/Trac-0.11-py2.4.egg/trac/wiki/", line 468, in _macro_formatter

return macro.process(args, in_paragraph=True)

File "/usr/lib/python2.4/site-packages/Trac-0.11-py2.4.egg/trac/wiki/", line 179, in process

text = self.processor(text)

File "/usr/lib/python2.4/site-packages/Trac-0.11-py2.4.egg/trac/wiki/", line 166, in _macro_processor


File "build/bdist.linux-i686/egg/freemind/", line 132, in expand_macro
File "build/bdist.linux-i686/egg/freemind/", line 48, in get_absolute_url

TypeError: coercing to Unicode: need string or buffer, tuple found
2008-10-20 08:37:35,594 Trac[main] DEBUG: 734 unreachable objects found.

comment:4 Changed 6 years ago by lcordier

  • Resolution set to fixed
  • Status changed from new to closed

(In [4544]) Fix #3922 and incorporate #3938.

Add Comment

Modify Ticket

as closed .
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from lcordier. Next status will be 'closed'.
The resolution will be deleted. Next status will be 'reopened'.

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.