Edgewall Software

Ticket #3018 (closed defect: fixed)

Opened 3 years ago

Last modified 3 years ago

trac-admin hotcopy broken, unicode related problem

Reported by: sam@… Owned by: cboos
Priority: normal Milestone: 0.10
Component: admin/console Version: devel
Severity: major Keywords: trac-admin unicode hotcopy
Cc: sam@…

Description

Running trac-admin hotcopy fails with the following error :

Command failed: unicode() argument 2 must be string, not None

Trac trunk/, fresh update.

Attachments

Change History

Changed 3 years ago by cboos

  • owner changed from daniel to cboos
  • priority changed from low to normal
  • milestone set to 0.10

Probably sys.stdin.encoding which is None for you.

Can you try this patch?

Index: admin.py
===================================================================
--- admin.py	(revision 3118)
+++ admin.py	(working copy)
@@ -90,7 +90,7 @@
         """`line` may be a `str` or an `unicode` object"""
         try:
             if isinstance(line, str):
-                line = unicode(line, sys.stdin.encoding)
+                line = util.to_unicode(line, sys.stdin.encoding)
             rv = cmd.Cmd.onecmd(self, line) or 0
         except SystemExit:
             raise

Changed 3 years ago by sam@…

Works like a charm.

Changed 3 years ago by cboos

Well, can you also try to create a new Milestone using trac-admin, "avé les assents" :)

I suspect there could be a problem there if sys.stdin.encoding is not known. It could then be worth to print a warning.

(+ what's your python version/platform?)

Changed 3 years ago by sam@…

Creating a milestone with an accent worked without warnings (in interactive mode).

Python 2.3.5 (#2, Mar  6 2006, 10:12:24) 
[GCC 4.0.3 20060304 (prerelease) (Debian 4.0.2-10)] on linux2
Linux frog 2.6.11-grsec #3 Sun Mar 6 20:05:04 CET 2005 i686 GNU/Linux

Changed 3 years ago by cboos

OK, and in Trac, the accent shows up correctly?

Changed 3 years ago by sam@…

Affirmative!

Changed 3 years ago by cboos

  • status changed from new to closed
  • resolution set to fixed

Also fixed by mgood in r3140 in order to solve #3030.

Add/Change #3018 (trac-admin hotcopy broken, unicode related problem)

Author



Change Properties
<Author field>
Action
as closed
Next status will be 'reopened'
to The owner will change from cboos. Next status will be 'closed'
 
Note: See TracTickets for help on using tickets.