Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
# Authors: Simo Sorce <ssorce@redhat.com> # # Copyright (C) 2007 Red Hat # see file 'COPYING' for use and warranty information # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. #
""" Convert a kerberos realm into the IPA suffix. """ s = realm_name.split(".") terms = ["dc=" + x.lower() for x in s] return ",".join(terms)
""" Case-insensitive but case-respecting dictionary.
This code is derived from python-ldap's cidict.py module, written by stroeder: http://python-ldap.sourceforge.net/
This version extends 'dict' so it works properly with TurboGears. If you extend UserDict, isinstance(foo, dict) returns false. """
lower_key = key.lower() del self._keys[lower_key] return super(CIDict, self).__delitem__(key.lower())
return super(CIDict, self).has_key(key.lower())
result = [] for k in self._keys.values(): result.append((k, self[k])) return result
copy = {} for k in self._keys.values(): copy[k] = self[k] return copy
return self.copy().iteritems()
return self.copy().iterkeys()
try: return self[key] except KeyError: self[key] = value return value
try: value = self[key] del self[key] return value except KeyError: if len(args) == 1: return args[0] raise
(lower_key, value) = super(CIDict, self).popitem() key = self._keys[lower_key] del self._keys[lower_key]
return (key, value)
"""A GSSError exception looks differently in python 2.4 than it does in python 2.5, deal with it."""
try: primary = e[0] secondary = e[1] except Exception: primary = e[0][0] secondary = e[0][1]
return (primary[0], secondary[0])
return value.encode('utf-8')
else: return utf8_encode_value(values) |