and this is the proposed patch
@@ -1230,13 +1230,13 @@ class Root(RPCRoot):
try:
current_val = getattr(system,field)
- except KeyError:
- current_val = ""
- # catch nullable fields return None.
- if current_val is None:
- current_val = ""
- new_val = str(kw.get(field) or "")
- if str(current_val) != new_val:
+ except AttributeError:
+ flash(_(u'Field %s is not a valid system property' % field))
+ continue
+
+ new_val = kw.get(field)
+
+ if unicode(current_val) != unicode(new_val):
----- "Raymond Mancy" <rmancy(a)redhat.com> wrote:
From: "Raymond Mancy" <rmancy(a)redhat.com>
To: "List for the development of the Beaker project"
<beaker-devel(a)lists.fedorahosted.org>
Sent: Wednesday, May 26, 2010 10:45:50 AM GMT +10:00 Brisbane
Subject: Re: [Beaker-devel] UTF-8 changes branch
Sure,
in controllers.py, line 1264, kw.get(field) returns a unicode object
(depending on what field it is) and then tries to convert it with
str().
Line 1265, current_val is also often a unicode object.
1264: new_val = str(kw.get(field) or "")
1265: if str(current_val) != new_val:
function_name = '%s_change_handler' % field
field_change_handler =
getattr(SystemSaveForm.handler,function_name,None)
if field_change_handler is not None:
kw =
field_change_handler(current_val,new_val,**kw)
And when you try and do
str(u"ス")
it dies a horrible death.
----- "Kevin Baker" <kbaker(a)redhat.com> wrote:
> From: "Kevin Baker" <kbaker(a)redhat.com>
> To: "List for the development of the Beaker project"
<beaker-devel(a)lists.fedorahosted.org>
> Sent: Wednesday, May 26, 2010 12:02:25 AM GMT +10:00 Brisbane
> Subject: Re: [Beaker-devel] UTF-8 changes branch
>
> can you post a code snippet that proves the failure
>
> On Tue, May 25, 2010 at 03:12:39AM -0400, Raymond Mancy wrote:
> > Actually the problem is slightly different from what I originally
> thought.
> >
> > I think what's actually happening is that a couple of places in
the
> code it tries to
> > create a str object from a unicode object. This works fine unless
> the unicode object has non
> > ascii characters.
> >
> > I think all we need to do is remove these attempts to create a str
> object from a unicode object
> > as it's not needed from what I can tell. So far i've only found
one
> place where it tries to do this.
> >
> > Raymond
> >
> >
> >
> > ----- "Kevin Baker" <kbaker(a)redhat.com> wrote:
> >
> > > From: "Kevin Baker" <kbaker(a)redhat.com>
> > > To: "Raymond Mancy" <rmancy(a)redhat.com>
> > > Cc: "Bill Peck" <bpeck(a)redhat.com>
> > > Sent: Monday, May 24, 2010 11:38:49 PM GMT +10:00 Brisbane
> > > Subject: Re: UTF-8 changes branch
> > >
> > > Ray,
> > >
> > > can you have this discussion on the dev list please.
> > >
> > > and who is e(a)redhat.com?
> > >
> > > On Mon, May 24, 2010 at 09:36:10AM -0400, Raymond Mancy wrote:
> > > >
> > >
>
http://git.fedorahosted.org/git/?p=beaker.git;a=commit;h=0076b616ada26d81...
> > > >
> > > > In model.py and controllers/py I kind of started to turn the
> strings
> > > into Unicode objects but then stopped.
> > > >
> > > > I was thinking we could override the __str__() function to do
> > > something like unicode(x).encode('utf-8').
> > > >
> > > >
> > >
> > > --
> > > Kevin Baker
> > > Manager Engineering Operations, Westford +1 978 392
2442
> > _______________________________________________
> > Beaker-devel mailing list
> > Beaker-devel(a)lists.fedorahosted.org
> >
https://fedorahosted.org/mailman/listinfo/beaker-devel
>
> --
> Kevin Baker
> Manager Engineering Operations, Westford +1 978 392 2442
> _______________________________________________
> Beaker-devel mailing list
> Beaker-devel(a)lists.fedorahosted.org
>
https://fedorahosted.org/mailman/listinfo/beaker-devel
_______________________________________________
Beaker-devel mailing list
Beaker-devel(a)lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/beaker-devel