← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:app-validators-print-function into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:app-validators-print-function into launchpad:master.

Commit message:
Port lp.app.validators to print_function

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/387208
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:app-validators-print-function into launchpad:master.
diff --git a/lib/lp/app/validators/__init__.py b/lib/lp/app/validators/__init__.py
index 7258333..99b112b 100644
--- a/lib/lp/app/validators/__init__.py
+++ b/lib/lp/app/validators/__init__.py
@@ -9,6 +9,8 @@ PostgreSQL as stored procedures.
 See README.txt for discussion
 """
 
+from __future__ import absolute_import, print_function
+
 __metaclass__ = type
 
 from zope.formlib.exception import (
@@ -41,13 +43,13 @@ class LaunchpadValidationError(ValidationError):
     may contain XHTML markup suitable for inclusion in an inline tag
     such as <span>.
 
-    >>> LaunchpadValidationError('<br/>oops').snippet()
-    u'&lt;br/&gt;oops'
+    >>> print(LaunchpadValidationError('<br/>oops').snippet())
+    &lt;br/&gt;oops
 
     >>> from lp.services.webapp.escaping import structured
-    >>> LaunchpadValidationError(
-    ...     structured('<a title="%s">Ok</a>', '<evil/>')).snippet()
-    u'<a title="&lt;evil/&gt;">Ok</a>'
+    >>> print(LaunchpadValidationError(
+    ...     structured('<a title="%s">Ok</a>', '<evil/>')).snippet())
+    <a title="&lt;evil/&gt;">Ok</a>
     """
 
     def __init__(self, message, already_escaped=False):
@@ -104,16 +106,16 @@ class WidgetInputErrorView(Z3WidgetInputErrorView):
         >>> bold_error = LaunchpadValidationError(structured("<b>Foo</b>"))
         >>> err = WidgetInputError("foo", "Foo", bold_error)
         >>> view = WidgetInputErrorView(err, None)
-        >>> view.snippet()
-        u'<b>Foo</b>'
+        >>> print(view.snippet())
+        <b>Foo</b>
 
         >>> class TooSmallError(object):
         ...     def doc(self):
         ...         return "Foo input < 1"
         >>> err = WidgetInputError("foo", "Foo", TooSmallError())
         >>> view = WidgetInputErrorView(err, None)
-        >>> view.snippet()
-        u'Foo input &lt; 1'
+        >>> print(view.snippet())
+        Foo input &lt; 1
         """
         if (hasattr(self.context, 'errors') and
                 ILaunchpadValidationError.providedBy(self.context.errors)):
diff --git a/lib/lp/app/validators/attachment.py b/lib/lp/app/validators/attachment.py
index a998673..0056c53 100644
--- a/lib/lp/app/validators/attachment.py
+++ b/lib/lp/app/validators/attachment.py
@@ -3,6 +3,8 @@
 
 """Validators for attachments."""
 
+from __future__ import absolute_import, print_function
+
 __metaclass__ = type
 __all__ = ['attachment_size_constraint']
 
diff --git a/lib/lp/app/validators/cve.py b/lib/lp/app/validators/cve.py
index 93c4f35..0a0407b 100644
--- a/lib/lp/app/validators/cve.py
+++ b/lib/lp/app/validators/cve.py
@@ -1,6 +1,8 @@
 # Copyright 2009 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
+from __future__ import absolute_import, print_function
+
 __metaclass__ = type
 
 import re
diff --git a/lib/lp/app/validators/email.py b/lib/lp/app/validators/email.py
index 5e3260a..d54e084 100644
--- a/lib/lp/app/validators/email.py
+++ b/lib/lp/app/validators/email.py
@@ -3,6 +3,8 @@
 
 """EmailAdress validator"""
 
+from __future__ import absolute_import, print_function
+
 __metaclass__ = type
 
 import re
diff --git a/lib/lp/app/validators/name.py b/lib/lp/app/validators/name.py
index 5b2575f..e0b16b2 100644
--- a/lib/lp/app/validators/name.py
+++ b/lib/lp/app/validators/name.py
@@ -3,6 +3,8 @@
 
 """Validators for the .name attribute (defined in various schemas.)"""
 
+from __future__ import absolute_import, print_function
+
 __metaclass__ = type
 
 import re
diff --git a/lib/lp/app/validators/url.py b/lib/lp/app/validators/url.py
index 40d934f..08511cf 100644
--- a/lib/lp/app/validators/url.py
+++ b/lib/lp/app/validators/url.py
@@ -1,6 +1,8 @@
 # Copyright 2009-2011 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
+from __future__ import absolute_import, print_function
+
 __metaclass__ = type
 
 __all__ = [
diff --git a/lib/lp/app/validators/username.py b/lib/lp/app/validators/username.py
index acfe874..40d69da 100644
--- a/lib/lp/app/validators/username.py
+++ b/lib/lp/app/validators/username.py
@@ -3,6 +3,8 @@
 
 """Validators for the clean-username (`Person.name`) attribute."""
 
+from __future__ import absolute_import, print_function
+
 __metaclass__ = type
 
 import re
diff --git a/lib/lp/app/validators/validation.py b/lib/lp/app/validators/validation.py
index ab7136a..cf06f21 100644
--- a/lib/lp/app/validators/validation.py
+++ b/lib/lp/app/validators/validation.py
@@ -1,6 +1,8 @@
 # Copyright 2009-2011 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
+from __future__ import absolute_import, print_function
+
 __metaclass__ = type
 
 __all__ = [
diff --git a/lib/lp/app/validators/version.py b/lib/lp/app/validators/version.py
index 170b869..3f7d163 100644
--- a/lib/lp/app/validators/version.py
+++ b/lib/lp/app/validators/version.py
@@ -1,6 +1,8 @@
 # Copyright 2009 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
+from __future__ import absolute_import, print_function
+
 __metaclass__ = type