Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 312388 Details for
Bug 454076
can't edit user win non-ascii letters in name
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
patch to fix template encoding
freeipa-61-encoding.patch (text/plain), 7.91 KB, created by
Rob Crittenden
on 2008-07-22 19:30:23 UTC
(
hide
)
Description:
patch to fix template encoding
Filename:
MIME Type:
Creator:
Rob Crittenden
Created:
2008-07-22 19:30:23 UTC
Size:
7.91 KB
patch
obsolete
>From 794484fd31cc65c834f8bb0e6fe1fdaf3fb7e683 Mon Sep 17 00:00:00 2001 >From: Rob Crittenden <rcrit@ipa.greyoak.com> >Date: Tue, 22 Jul 2008 15:14:23 -0400 >Subject: [PATCH] Fix encoding issue when manually loading templates for forms > >We used to manually load the template files for the edit pages using >turbogears.meta.load_kid_template(). Unfortunately this went through >the one code path where encoding was completely ignored. It ended up >defaulting to sys.getdefaultencoding() which is 'ascii'. So even though >most of the templates are loaded as 'utf-8' the few that really mattered >weren't. > >The fix is to call kid.load_template() ourselves and set the encoding of >the class we just loaded to either the setting in the app.cfg file or >to the normal default value of 'utf-8'. > >454076 >--- > ipa-server/ipa-gui/ipagui/forms/delegate.py | 3 +- > ipa-server/ipa-gui/ipagui/forms/group.py | 5 ++- > ipa-server/ipa-gui/ipagui/forms/ipapolicy.py | 3 +- > ipa-server/ipa-gui/ipagui/forms/principal.py | 3 +- > ipa-server/ipa-gui/ipagui/forms/user.py | 7 ++++- > ipa-server/ipa-gui/ipagui/helpers/ipahelper.py | 26 ++++++++++++++++++++++++ > 6 files changed, 40 insertions(+), 7 deletions(-) > >diff --git a/ipa-server/ipa-gui/ipagui/forms/delegate.py b/ipa-server/ipa-gui/ipagui/forms/delegate.py >index 0c080b3..e7ba03f 100644 >--- a/ipa-server/ipa-gui/ipagui/forms/delegate.py >+++ b/ipa-server/ipa-gui/ipagui/forms/delegate.py >@@ -17,6 +17,7 @@ > > import turbogears > from turbogears import validators, widgets >+from ipagui.helpers import ipahelper > > from ipagui.forms.user import UserFields > >@@ -101,7 +102,7 @@ class DelegateForm(widgets.Form): > > def __init__(self, *args, **kw): > super(DelegateForm,self).__init__(*args, **kw) >- (self.template_c, self.template) = widgets.meta.load_kid_template( >+ (self.template_c, self.template) = ipahelper.load_template( > "ipagui.templates.delegateform") > self.delegate_fields = DelegateFields > >diff --git a/ipa-server/ipa-gui/ipagui/forms/group.py b/ipa-server/ipa-gui/ipagui/forms/group.py >index 0904d31..4835e91 100644 >--- a/ipa-server/ipa-gui/ipagui/forms/group.py >+++ b/ipa-server/ipa-gui/ipagui/forms/group.py >@@ -18,6 +18,7 @@ > import turbogears > from turbogears import validators, widgets > from tg_expanding_form_widget.tg_expanding_form_widget import ExpandingForm >+from ipagui.helpers import ipahelper > > class GroupFields(object): > cn = widgets.TextField(name="cn", label="Name") >@@ -50,7 +51,7 @@ class GroupNewForm(widgets.Form): > > def __init__(self, *args, **kw): > super(GroupNewForm,self).__init__(*args, **kw) >- (self.template_c, self.template) = widgets.meta.load_kid_template("ipagui.templates.groupnewform") >+ (self.template_c, self.template) = ipahelper.load_template("ipagui.templates.groupnewform") > self.group_fields = GroupFields > > def update_params(self, params): >@@ -80,5 +81,5 @@ class GroupEditForm(widgets.Form): > > def __init__(self, *args, **kw): > super(GroupEditForm,self).__init__(*args, **kw) >- (self.template_c, self.template) = widgets.meta.load_kid_template("ipagui.templates.groupeditform") >+ (self.template_c, self.template) = ipahelper.load_template("ipagui.templates.groupeditform") > self.group_fields = GroupFields >diff --git a/ipa-server/ipa-gui/ipagui/forms/ipapolicy.py b/ipa-server/ipa-gui/ipagui/forms/ipapolicy.py >index 8d39fa4..7ad9fe0 100644 >--- a/ipa-server/ipa-gui/ipagui/forms/ipapolicy.py >+++ b/ipa-server/ipa-gui/ipagui/forms/ipapolicy.py >@@ -18,6 +18,7 @@ > import turbogears > from turbogears import validators, widgets > from tg_expanding_form_widget.tg_expanding_form_widget import ExpandingForm >+from ipagui.helpers import ipahelper > > class IPAPolicyFields(object): > # From cn=ipaConfig >@@ -78,7 +79,7 @@ class IPAPolicyForm(widgets.Form): > > def __init__(self, *args, **kw): > super(IPAPolicyForm,self).__init__(*args, **kw) >- (self.template_c, self.template) = widgets.meta.load_kid_template( >+ (self.template_c, self.template) = ipahelper.load_template( > "ipagui.templates.ipapolicyeditform") > self.ipapolicy_fields = IPAPolicyFields > >diff --git a/ipa-server/ipa-gui/ipagui/forms/principal.py b/ipa-server/ipa-gui/ipagui/forms/principal.py >index 6c1ac56..02c62f2 100644 >--- a/ipa-server/ipa-gui/ipagui/forms/principal.py >+++ b/ipa-server/ipa-gui/ipagui/forms/principal.py >@@ -18,6 +18,7 @@ > import turbogears > from turbogears import validators, widgets > from tg_expanding_form_widget.tg_expanding_form_widget import ExpandingForm >+from ipagui.helpers import ipahelper > > class PrincipalFields(object): > hostname = widgets.TextField(name="hostname", label="Host Name") >@@ -50,7 +51,7 @@ class PrincipalNewForm(widgets.Form): > > def __init__(self, *args, **kw): > super(PrincipalNewForm,self).__init__(*args, **kw) >- (self.template_c, self.template) = widgets.meta.load_kid_template("ipagui.templates.principalnewform") >+ (self.template_c, self.template) = ipahelper.load_template("ipagui.templates.principalnewform") > self.principal_fields = PrincipalFields > > def update_params(self, params): >diff --git a/ipa-server/ipa-gui/ipagui/forms/user.py b/ipa-server/ipa-gui/ipagui/forms/user.py >index 2c10eea..a3880f4 100644 >--- a/ipa-server/ipa-gui/ipagui/forms/user.py >+++ b/ipa-server/ipa-gui/ipagui/forms/user.py >@@ -19,6 +19,7 @@ import turbogears > from turbogears import validators, widgets > from tg_expanding_form_widget.tg_expanding_form_widget import ExpandingForm > from ipagui.helpers.validators import * >+from ipagui.helpers import ipahelper > > class UserFields(object): > givenname = widgets.TextField(name="givenname", label="First Name") >@@ -120,7 +121,8 @@ class UserNewForm(widgets.Form): > > def __init__(self, *args, **kw): > super(UserNewForm,self).__init__(*args, **kw) >- (self.template_c, self.template) = widgets.meta.load_kid_template("ipagui.templates.usernewform") >+ (self.template_c, self.template) = ipahelper.load_template("ipagui.templates.usernewform") >+ > self.user_fields = UserFields > > def update_params(self, params): >@@ -172,7 +174,8 @@ class UserEditForm(widgets.Form): > > def __init__(self, *args, **kw): > super(UserEditForm,self).__init__(*args, **kw) >- (self.template_c, self.template) = widgets.meta.load_kid_template("ipagui.templates.usereditform") >+ (self.template_c, self.template) = ipahelper.load_template("ipagui.templates.usereditform") >+ > self.user_fields = UserFields > > >diff --git a/ipa-server/ipa-gui/ipagui/helpers/ipahelper.py b/ipa-server/ipa-gui/ipagui/helpers/ipahelper.py >index 4eb7644..9b34048 100644 >--- a/ipa-server/ipa-gui/ipagui/helpers/ipahelper.py >+++ b/ipa-server/ipa-gui/ipagui/helpers/ipahelper.py >@@ -17,6 +17,10 @@ > > import re > import logging >+import turbogears >+import kid >+from turbokid import kidsupport >+from pkg_resources import resource_filename > > def javascript_string_escape(input): > """Escapes the ' " and \ characters in a string so >@@ -60,3 +64,25 @@ def fix_incoming_fields(fields, fieldname, multifieldname): > logging.warn("fix_incoming_fields error: " + str(e)) > > return fields >+ >+def load_template(classname, encoding=None): >+ """ >+ Loads the given template. This only handles .kid files. >+ Returns a tuple (compiled_tmpl, None) to emulate >+ turbogears.meta.load_kid_template() which ends up not properly handling >+ encoding. >+ """ >+ if not encoding: >+ encoding = turbogears.config.get('kid.encoding', kidsupport.KidSupport.assume_encoding) >+ divider = classname.rfind(".") >+ package, basename = classname[:divider], classname[divider+1:] >+ file_path = resource_filename(package, basename + ".kid") >+ >+ tclass = kid.load_template( >+ file_path, >+ name = classname, >+ ).Template >+ tclass.serializer = kid.HTMLSerializer(encoding=encoding) >+ tclass.assume_encoding=encoding >+ >+ return (tclass, None) >-- >1.5.4.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 454076
:
311039
|
312362
| 312388