Re: [Freeipa-devel] [PATCH] 059 Use unicode parameters in the host plugin

2011-02-18 Thread Rob Crittenden

Jakub Hrozek wrote:

On Thu, Feb 17, 2011 at 11:30:03AM +0100, Jan Zelený wrote:

Better, thanks. I'd also like to change the code which is using this function,
so the conversion doesn't take place twice.


I think it's safe. The documentation on unicode() says:

---
More precisely, if object is a Unicode string or subclass it
will return that Unicode string without any additional decoding applied.


pushed to master

___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel


Re: [Freeipa-devel] [PATCH] 059 Use unicode parameters in the host plugin

2011-02-17 Thread Jan Zelený
Jakub Hrozek jhro...@redhat.com wrote:
 While reviewing Rob's latest patch I found out that we didn't convert to
 unicode on couple of places in the host plugin.

ack

Jan

___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel


Re: [Freeipa-devel] [PATCH] 059 Use unicode parameters in the host plugin

2011-02-17 Thread Jan Zelený
Jan Zelený jzel...@redhat.com wrote:
 Jakub Hrozek jhro...@redhat.com wrote:
  While reviewing Rob's latest patch I found out that we didn't convert to
  unicode on couple of places in the host plugin.
 
 ack

On a second thoughts - maybe the _get_unicode_reverse_zone isn't necessary at 
all - is it possible to do this change directly at the get_reverse_zone?

Jan

___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel


Re: [Freeipa-devel] [PATCH] 059 Use unicode parameters in the host plugin

2011-02-17 Thread Jakub Hrozek
On Thu, Feb 17, 2011 at 11:06:35AM +0100, Jan Zelený wrote:
 Jan Zelený jzel...@redhat.com wrote:
  Jakub Hrozek jhro...@redhat.com wrote:
   While reviewing Rob's latest patch I found out that we didn't convert to
   unicode on couple of places in the host plugin.
  
  ack
 
 On a second thoughts - maybe the _get_unicode_reverse_zone isn't necessary at 
 all - is it possible to do this change directly at the get_reverse_zone?
 
 Jan
 

attached.

also removed a line of dead code.
From 96b1342c815435d505be246478f22f902cab6250 Mon Sep 17 00:00:00 2001
From: Jakub Hrozek jhro...@redhat.com
Date: Wed, 16 Feb 2011 10:33:24 -0500
Subject: [PATCH] Use unicode parameters in the host plugin

https://fedorahosted.org/freeipa/ticket/977
---
 ipaserver/install/bindinstance.py |4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/ipaserver/install/bindinstance.py 
b/ipaserver/install/bindinstance.py
index ea9280b..e005653 100644
--- a/ipaserver/install/bindinstance.py
+++ b/ipaserver/install/bindinstance.py
@@ -108,7 +108,7 @@ def get_reverse_zone(ip_address_str):
 else:
 raise ValueError('Bad address format?')
 
-return zone, name
+return unicode(zone), unicode(name)
 
 def dns_zone_exists(name):
 try:
@@ -276,8 +276,6 @@ class BindInstance(service.Service):
 else:
 self.zonemgr = 'root.%s.%s' % (self.host, self.domain)
 
-self.reverse_subnet, self.reverse_host = get_reverse_zone(ip_address)
-
 self.__setup_sub_dict()
 
 def create_sample_bind_zone(self):
-- 
1.7.4

___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Re: [Freeipa-devel] [PATCH] 059 Use unicode parameters in the host plugin

2011-02-17 Thread Jan Zelený
Jakub Hrozek jhro...@redhat.com wrote:
 On Thu, Feb 17, 2011 at 11:06:35AM +0100, Jan Zelený wrote:
  Jan Zelený jzel...@redhat.com wrote:
   Jakub Hrozek jhro...@redhat.com wrote:
While reviewing Rob's latest patch I found out that we didn't convert
to unicode on couple of places in the host plugin.
   
   ack
  
  On a second thoughts - maybe the _get_unicode_reverse_zone isn't
  necessary at all - is it possible to do this change directly at the
  get_reverse_zone?
  
  Jan
 
 attached.
 
 also removed a line of dead code.

Better, thanks. I'd also like to change the code which is using this function, 
so the conversion doesn't take place twice. On the other hand that would be 
rather big change, which IMO shouldn't occur in RC. I think filing a cleanup 
ticket for this is the best option.

Ack

Jan

___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel


Re: [Freeipa-devel] [PATCH] 059 Use unicode parameters in the host plugin

2011-02-17 Thread Jakub Hrozek
On Thu, Feb 17, 2011 at 11:30:03AM +0100, Jan Zelený wrote:
 Better, thanks. I'd also like to change the code which is using this function,
 so the conversion doesn't take place twice. 

I think it's safe. The documentation on unicode() says:

---
More precisely, if object is a Unicode string or subclass it
will return that Unicode string without any additional decoding applied.


___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel


[Freeipa-devel] [PATCH] 059 Use unicode parameters in the host plugin

2011-02-16 Thread Jakub Hrozek
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

While reviewing Rob's latest patch I found out that we didn't convert to
unicode on couple of places in the host plugin.
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iEYEARECAAYFAk1b8WUACgkQHsardTLnvCWRjwCfZfOqAStP6exuq7oRlw9N4CuF
YtkAnRHwT/In85pu3E+y/w0DetsumYBF
=XUgJ
-END PGP SIGNATURE-
From 998b867343d1870d26a548646a6652c0c7acb838 Mon Sep 17 00:00:00 2001
From: Jakub Hrozek jhro...@redhat.com
Date: Wed, 16 Feb 2011 10:33:24 -0500
Subject: [PATCH] Use unicode parameters in the host plugin

---
 ipalib/plugins/host.py |   11 ---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/ipalib/plugins/host.py b/ipalib/plugins/host.py
index bfdef57..0a97335 100644
--- a/ipalib/plugins/host.py
+++ b/ipalib/plugins/host.py
@@ -97,6 +97,10 @@ import nss.nss as nss
 import netaddr
 
 
+def _get_unicode_reverse_zone(ipaddr):
+revzone, revname = get_reverse_zone(ipaddr)
+return unicode(revzone), unicode(revname)
+
 def validate_host(ugettext, fqdn):
 
 Require at least one dot in the hostname (to support localhost.localdomain)
@@ -118,7 +122,7 @@ def is_forward_record(zone, str_address):
 
 def remove_fwd_ptr(ipaddr, host, domain, recordtype):
 api.log.debug('deleting ipaddr %s' % ipaddr)
-revzone, revname = get_reverse_zone(ipaddr)
+revzone, revname = _get_unicode_reverse_zone(ipaddr)
 try:
 delkw = { 'ptrrecord' : %s.%s. % (host, domain) }
 api.Command['dnsrecord_del'](revzone, revname, **delkw)
@@ -131,6 +135,7 @@ def remove_fwd_ptr(ipaddr, host, domain, recordtype):
 except errors.NotFound:
 pass
 
+
 host_output_params = (
 Flag('has_keytab',
 label=_('Keytab'),
@@ -317,7 +322,7 @@ class host_add(LDAPCreate):
 raise errors.NotFound(reason=_('DNS zone %(zone)s not found' % dict(zone=domain)))
 if not options.get('no_reverse', False):
 # we prefer lookup of the IP through the reverse zone
-revzone, revname = get_reverse_zone(options['ip_address'])
+revzone, revname = _get_unicode_reverse_zone(options['ip_address'])
 # Verify that our reverse zone exists
 match = False
 for zone in result:
@@ -374,7 +379,7 @@ class host_add(LDAPCreate):
 add_forward_record(domain, parts[0], options['ip_address'])
 
 if not options.get('no_reverse', False):
-revzone, revname = get_reverse_zone(options['ip_address'])
+revzone, revname = _get_unicode_reverse_zone(options['ip_address'])
 try:
 addkw = { 'ptrrecord' : keys[-1]+'.' }
 api.Command['dnsrecord_add'](revzone, revname, **addkw)
-- 
1.7.3.4

___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel