Branch 'pykolab-0.4' - 6 commits - configure.ac pykolab/setup pykolab.spec.in pykolab/utils.py

Jeroen van Meeuwen vanmeeuwen at kolabsys.com
Tue May 15 10:17:06 CEST 2012


 configure.ac               |    2 -
 pykolab.spec.in            |    1 
 pykolab/setup/setup_mta.py |    2 -
 pykolab/utils.py           |   48 ++++++++++++++++++++-------------------------
 4 files changed, 25 insertions(+), 28 deletions(-)

New commits:
commit 39c1598ad0273561da43742f3858f5ed3789095a
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Tue May 15 09:16:26 2012 +0100

    Release 0.4.5

diff --git a/configure.ac b/configure.ac
index eb48360..ad6995a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,4 @@
-AC_INIT([pykolab], 0.4.4)
+AC_INIT([pykolab], 0.4.5)
 AC_SUBST([RELEASE], 1)
 
 AC_CONFIG_SRCDIR(pykolab/constants.py.in)


commit 7c6c6caa69b0022d4bb02dc5a0f4fd61bb8ef485
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Tue May 15 09:08:21 2012 +0100

    Fix confirmation dialog
    Fix ask_question() with confirm=True

diff --git a/pykolab/utils.py b/pykolab/utils.py
index 0da1664..f0fa30a 100644
--- a/pykolab/utils.py
+++ b/pykolab/utils.py
@@ -52,15 +52,9 @@ def ask_question(question, default="", password=False, confirm=False):
             answer_confirmed = False
             while not answer_confirmed:
                 if password:
-                    if default == "" or default == None:
-                        answer = getpass.getpass(_("Confirm %s: ") % (question))
-                    else:
-                        answer = getpass.getpass(_("Confirm %s [%s]: ") % (question, default))
+                    answer_confirm = getpass.getpass(_("Confirm %s: ") % (question))
                 else:
-                    if default == "" or default == None:
-                        answer = raw_input(_("Confirm %s: ") % (question))
-                    else:
-                        answer = raw_input(_("Confirm %s [%s]: ") % (question, default))
+                    answer_confirm = raw_input(_("Confirm %s: ") % (question))
 
                 if not answer_confirm == answer:
                     print >> sys.stderr, _("Incorrect confirmation. " + \
@@ -68,14 +62,14 @@ def ask_question(question, default="", password=False, confirm=False):
 
                     if password:
                         if default == "" or default == None:
-                            answer = getpass.getpass(_("Confirm %s: ") % (question))
+                            answer = getpass.getpass(_("%s: ") % (question))
                         else:
-                            answer = getpass.getpass(_("Confirm %s [%s]: ") % (question, default))
+                            answer = getpass.getpass(_("%s [%s]: ") % (question, default))
                     else:
                         if default == "" or default == None:
-                            answer = raw_input(_("Confirm %s: ") % (question))
+                            answer = raw_input(_("%s: ") % (question))
                         else:
-                            answer = raw_input(_("Confirm %s [%s]: ") % (question, default))
+                            answer = raw_input(_("%s [%s]: ") % (question, default))
 
                 else:
                     answer_confirmed = True
@@ -91,12 +85,14 @@ def ask_confirmation(question, default="y", all_inclusive_no=True):
         and a "yes" or "no" parsing that can either require an explicit, full
         "yes" or "no", or take the default or any YyNn answer.
     """
+    default_answer = None
+
     if default in [ "y", "Y" ]:
         default_answer = True
         default_no = "n"
         default_yes = "Y"
     elif default in [ "n", "N" ]:
-        default_answer = True
+        default_answer = False
         default_no = "N"
         default_yes = "y"
     else:
@@ -110,20 +106,20 @@ def ask_confirmation(question, default="y", all_inclusive_no=True):
         answer = raw_input("%s [%s/%s]: " % (question,default_yes,default_no))
         # Parse answer and set back to False if not appropriate
         if all_inclusive_no:
-            if not answer in [ "y", "Y", "yes" ]:
-                return False
-            else:
-                return True
-        else:
-            if answer in [ "y", "Y", "yes" ]:
+            if answer == "" and not default_answer == None:
+                return default_answer
+            elif answer in [ "y", "Y", "yes" ]:
                 return True
             elif answer in [ "n", "N", "no" ]:
                 return False
-            elif answer == "" and not default_answer == None:
-                return default_answer
             else:
                 answer = False
                 print >> sys.stderr, _("Please answer 'yes' or 'no'.")
+        else:
+            if not answer in [ "y", "Y", "yes" ]:
+                return False
+            else:
+                return True
 
 def generate_password():
     import subprocess


commit 4164aff2a7e7b958de6ae3c58f15ee618fbdba5f
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Mon May 14 11:58:01 2012 +0100

    Default can be an empty string as well as None (if the default is a missing configuration value)

diff --git a/pykolab/utils.py b/pykolab/utils.py
index ceb6f68..0da1664 100644
--- a/pykolab/utils.py
+++ b/pykolab/utils.py
@@ -36,12 +36,12 @@ def ask_question(question, default="", password=False, confirm=False):
         Usage: pykolab.utils.ask_question("What is the server?", default="localhost")
     """
     if password:
-        if default == "":
+        if default == "" or default == None:
             answer = getpass.getpass("%s: " % (question))
         else:
             answer = getpass.getpass("%s [%s]: " % (question, default))
     else:
-        if default == "":
+        if default == "" or default == None:
             answer = raw_input("%s: " % (question))
         else:
             answer = raw_input("%s [%s]: " % (question, default))
@@ -52,12 +52,12 @@ def ask_question(question, default="", password=False, confirm=False):
             answer_confirmed = False
             while not answer_confirmed:
                 if password:
-                    if default == "":
+                    if default == "" or default == None:
                         answer = getpass.getpass(_("Confirm %s: ") % (question))
                     else:
                         answer = getpass.getpass(_("Confirm %s [%s]: ") % (question, default))
                 else:
-                    if default == "":
+                    if default == "" or default == None:
                         answer = raw_input(_("Confirm %s: ") % (question))
                     else:
                         answer = raw_input(_("Confirm %s [%s]: ") % (question, default))
@@ -67,12 +67,12 @@ def ask_question(question, default="", password=False, confirm=False):
                             "Please try again.")
 
                     if password:
-                        if default == "":
+                        if default == "" or default == None:
                             answer = getpass.getpass(_("Confirm %s: ") % (question))
                         else:
                             answer = getpass.getpass(_("Confirm %s [%s]: ") % (question, default))
                     else:
-                        if default == "":
+                        if default == "" or default == None:
                             answer = raw_input(_("Confirm %s: ") % (question))
                         else:
                             answer = raw_input(_("Confirm %s [%s]: ") % (question, default))


commit 00f37251e8d6681514d4084af69d1bd58a2cef59
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Sat May 12 14:39:25 2012 +0100

    Make utils.multiline_message() prepend and append a carrier return for clarity on the console

diff --git a/pykolab/utils.py b/pykolab/utils.py
index 325446f..ceb6f68 100644
--- a/pykolab/utils.py
+++ b/pykolab/utils.py
@@ -162,7 +162,7 @@ def multiline_message(message):
 
     lines.append(line)
 
-    return "\n".join(lines)
+    return "\n%s\n" % ("\n".join(lines))
 
 def normalize(_object):
     if type(_object) == list:


commit 1b24264e3c7cc93422590c7580139b35ad7d8501
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Tue May 15 09:07:20 2012 +0100

    Require cyrus-sasl-plain (#763)

diff --git a/pykolab.spec.in b/pykolab.spec.in
index a613765..9c05b88 100644
--- a/pykolab.spec.in
+++ b/pykolab.spec.in
@@ -68,6 +68,7 @@ Summary:            Kolab SASL Authentication Daemon
 Group:              Applications/System
 BuildRequires:      intltool, gettext, python
 Requires:           %{name} = %{version}-%{release}
+Requires:           cyrus-sasl-plain
 
 %description -n kolab-saslauthd
 Kolab SASL Authentication Daemon for multi-domain, multi-authn database deployments


commit eef5f8a38b71466a1911142bbedf1c276294da4f
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Mon May 14 12:53:11 2012 +0100

    The setting is called content_filter, not content-filter

diff --git a/pykolab/setup/setup_mta.py b/pykolab/setup/setup_mta.py
index 36a5a25..93db617 100644
--- a/pykolab/setup/setup_mta.py
+++ b/pykolab/setup/setup_mta.py
@@ -201,7 +201,7 @@ result_attribute = mail
             "submission_recipient_restrictions": "check_policy_service unix:private/submission_policy, permit_sasl_authenticated, reject",
             "submission_sender_restrictions": "reject_non_fqdn_sender, check_policy_service unix:private/submission_policy, permit_sasl_authenticated, reject",
             "submission_data_restrictions": "check_policy_service unix:private/submission_policy",
-            "content-filter": "smtp-amavis:[127.0.0.1]:10024"
+            "content_filter": "smtp-amavis:[127.0.0.1]:10024"
 
         }
 





More information about the commits mailing list