[darcs-users] Re: darcsweb - A gitweb-alike web interface for darcs

Stephane Bortzmeyer bortzmeyer at nic.fr
Mon Jul 18 07:25:08 UTC 2005


On Fri, Jul 15, 2005 at 09:12:00AM +0200,
 Michal Sojka <sojkam1 at control.felk.cvut.cz> wrote 
 a message of 43 lines which said:

> AttributeError: 'unicode' object has no attribute 'decode'
>       args = ("'unicode' object has no attribute 'decode'",)
> 
> It occurs at line 76 of darcsweb.cgi:
> 
>  /var/www/localhost/htdocs/darcs/darcsweb.cgi in fixu8
> (s=u'20050714170919-f2ef6-4a726324666839d75840810d3e3984e4580a89bb.gz')
>    74                 # small optimization to avoid the conversion to utf8 and
>    75                 # entering the loop
>    76                 return s.decode(config.repoencoding).encode('utf8')
>    77 
>    78         s = s.encode(config.repoencoding).decode('raw_unicode_escape')
> s = u'20050714170919-f2ef6-4a726324666839d75840810d3e3984e4580a89bb.gz', 
> s.decode undefined, global config = <class __main__.config>, 
> config.repoencoding = 'latin1', ).encode = <built-in method encode of str 
> object>

May be (untested):

Beginning:

import types

Line 76:

if isinstance(s, types.UnicodeType):
   return s.encode('utf8')
else:
   return s.decode(config.repoencoding).encode('utf8')

But this is just a workaround, not a real fix.




More information about the darcs-users mailing list