Modify

Opened 16 years ago

Closed 16 years ago

#3922 closed defect (fixed)

coercing to Unicode: need string or buffer, tuple found

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

Description

Hi,

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/filename.mm?) failed

coercing to Unicode: need string or buffer, tuple found

Thanks!

Attachments (0)

Change History (4)

comment:1 Changed 16 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.

  • .svn000.tmp.py

    diff U11i macro.py-rev4500.svn000.tmp.py macro.py-rev4514.svn000.tmp.py
    old new  
    8888   
    8989    return result
    9090
    9191
    9292class FreemindMacro(WikiMacroBase):
    9393   
    9494    implements(IWikiMacroProvider, ITemplateProvider)
    9595   
    9696    # IWikiMacroProvider methods
    9797    def expand_macro(self, formatter, name, content):
    9898        args, kwargs = parse_args(content, strict=False)
     99        kwargs = string_keys(kwargs)
    99100       
    100101        if len(args) >= 1:
    101102            url = args[0]
    102103        elif len(args) == 0:
    103104            raise TracError('URL to the mindmap at least required.')
    104105       
    105106        embed_count = getattr(formatter, EMBED_COUNT, 0)
    106107        embed_count += 1
    107108        setattr(formatter, EMBED_COUNT, embed_count)
    108109       
    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        }
    152153       
    153         kwargs = string_keys(kwargs)
    154154        style_dict = xform_style(kwargs.get('style', ''))
    155155       
    156156        width = kwargs.pop('width', style_dict.get('width', '800px'))
    157157        height = kwargs.pop('height', style_dict.get('height', '600px'))
    158158       
    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
    163163       
    164164        kwargs['style'] = xform_style(style_dict)

comment:2 Changed 16 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/filename.mm) failed am I correct in assuming that you have a wiki-page named WikiPageName and you actually attached a file named filename.mm to that page ?

comment:3 Changed 16 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/filename.mm?) failed Traceback (most recent call last):

File "/usr/lib/python2.4/site-packages/Trac-0.11-py2.4.egg/trac/wiki/formatter.py", 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/formatter.py", line 179, in process

text = self.processor(text)

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

text)

File "build/bdist.linux-i686/egg/freemind/macro.py", line 132, in expand_macro File "build/bdist.linux-i686/egg/freemind/macro.py", 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 16 years ago by Louis Cordier

Resolution: fixed
Status: newclosed

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

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Louis Cordier.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


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

 
Note: See TracTickets for help on using tickets.