Ticket #296 (closed task: fixed)

Opened 3 years ago

Last modified 1 day ago

unicode' object has no attribute 'partition

Reported by: hkunz@ifi.uzh.ch Assigned to: moschny
Priority: normal Milestone: 2.0
Component: uka.transport Version: tracnav-3.92
Severity: normal Keywords:
Cc: Hohenems

Description

Hi,

I upgraded from trac 0.10 to 0.11.1 Upgrading TracNav to 4.1 didn't work. I get

Error: Macro TracNav(TracNav/Main) failed

'unicode' object has no attribute 'partition'

thanks for any hints resolving this.

cheers, Hanspeter

Attachments

Change History

11/09/08 09:14:03 changed by christian@ipeople.dk

I see the same issue. My setup is as follows:

  • Fedora Core 4 on Amazon EC2
  • Python 2.4
  • Trac 0.11.1
  • PostgreSQL 8.2
  • Psycopg2
  • TracNac installed via easy_install (version 4.1)

Every page with TracNav shows a:

Error: Macro TracNav(Manual/Toc) failed

'unicode' object has no attribute 'partition'

11/09/08 11:30:35 changed by christian@ipeople.dk

  • cc set to christian@ipeople.dk.

A little further research has revealed that this is a python 2.4 issue with TracNav. Line 129 of tracnav.py:

 for arg, _, values in map(lambda s: s.partition('='), args.split('|')):

The partition method is added to the string class as of Python 2.5 (as shown here: http://bytes.com/forum/thread537988.html among other places).

I guess Python 2.5 should be listed as a requirement or the above line should be rewritten to work without the partition method.

11/09/08 11:49:47 changed by christian@ipeople.dk

Update:

Being a little desperate I decided to hack this to work. I followed the steps below to make TracNav work with my Python 2.4 setup.

  • Get the source from SVN
  • Edit tracnav.py from line 129 - my file looks like this after edit
                #Commented out to ignore Python 2.4 issues
                #Using hardcoded config instead
                self.collapse = True
                self.modify = True
                self.reorder = True
    
                #for arg, _, values in map(lambda s: s.partition('='), args.split('|')):
                #    arg = arg.strip()
                #    if arg == 'nocollapse':
                #        self.collapse = False
                #    elif arg == 'noedit':
                #        self.modify = False
                #    elif arg == 'noreorder':
                #        self.reorder = False
                #    elif arg == 'allowed_macros':
                #        self.allowed_macros = map(lambda s: s.strip(), values.split(','))
                #    else:
                #        self.names.append(arg)
    
    
  • Remove any old installs of TracNav
  • Build and install the modified version

Note: This approach has the following drawbacks:

  • No configuration possible from Trac
  • You TOC MUST be at /wiki/TOC (this can possibly also be hardcoded..)
  • Possibly others - I intent to use this only untill a fix is released or I upgrade to python 2.5

11/09/08 12:49:25 changed by moschny

  • status changed from new to assigned.

Hi guys, sorry for breaking backwards compatibility with Python 2.4.

Committed a fix in [3273], please test. You should be able to use

easy_install TracNav==dev

to install the development version.

11/09/08 13:48:17 changed by hkunz@ifi.uzh.ch

  • status changed from assigned to closed.
  • resolution set to fixed.

Installed the newest development version - worked! excellent. Many thanks, Hp.

09/12/11 17:04:47 changed by bosaloek

  • cc changed from christian@ipeople.dk to Toronto.
  • component changed from trac.tracnav to uka.transport.
  • summary changed from 'unicode' object has no attribute 'partition' to unicode' object has no attribute 'partition.
  • version changed from tracnav-devel to tracnav-3.92.
  • milestone set to 2.0.
  • type changed from defect to task.

9yrrqwvn86hjb5lyiwu2

02/07/12 16:26:32 changed by TypeArtiterem

  • cc changed from Toronto to Hohenems.

<a href=></a> <a href=></a> <a href=></a> <a href=></a> <a href=></a> <a href=></a>

02/07/12 16:26:34 changed by TypeArtiterem

<a href=></a> <a href=></a> <a href=></a> <a href=></a> <a href=></a> <a href=></a>

02/07/12 16:26:35 changed by TypeArtiterem

<a href=></a> <a href=></a> <a href=></a> <a href=></a> <a href=></a> <a href=></a>

02/07/12 16:26:36 changed by TypeArtiterem

<a href=></a> <a href=></a> <a href=></a> <a href=></a> <a href=></a> <a href=></a>

02/07/12 16:26:39 changed by TypeArtiterem

<a href=></a> <a href=></a> <a href=></a> <a href=></a> <a href=></a> <a href=></a>

02/07/12 16:26:40 changed by TypeArtiterem

<a href=></a> <a href=></a> <a href=></a> <a href=></a> <a href=></a> <a href=></a>

02/07/12 16:26:42 changed by TypeArtiterem

<a href=></a> <a href=></a> <a href=></a> <a href=></a> <a href=></a> <a href=></a>

02/07/12 16:26:44 changed by TypeArtiterem

<a href=></a> <a href=></a> <a href=></a> <a href=></a> <a href=></a> <a href=></a>


Add/Change #296 (unicode' object has no attribute 'partition)




Change Properties
Action