[Testbot] Plone 5.0 - Python 2.7 - Build # 4256 - Fixed! - 0 failure(s)

jenkins at plone.org jenkins at plone.org
Mon Feb 16 22:11:23 UTC 2015


-------------------------------------------------------------------------------
Plone 5.0 - Python 2.7 - Build # 4256 - Fixed!
-------------------------------------------------------------------------------

http://jenkins.plone.org/job/plone-5.0-python-2.7/4256/


-------------------------------------------------------------------------------
CHANGES
-------------------------------------------------------------------------------

Repository: plone.app.textfield
Branch: refs/heads/master
Date: 2015-02-16T13:41:19-08:00
Author: David Glick (davisagli) <david at glicksoftware.com>
Commit: https://github.com/plone/plone.app.textfield/commit/87e02670715bfe95459613e38e032937e83762b2

add __eq__ for RichTextValue

Files changed:
M docs/HISTORY.rst
M plone/app/textfield/field.rst
M plone/app/textfield/value.py

diff --git a/docs/HISTORY.rst b/docs/HISTORY.rst
index 4fae0b8..44584de 100644
--- a/docs/HISTORY.rst
+++ b/docs/HISTORY.rst
@@ -4,6 +4,9 @@ Changelog
 1.2.5 (unreleased)
 ------------------
 
+- Add equality check (`__eq__`) for RawValueHolder and RichTextValue;
+  [davisagli]
+
 - Fix marshaler decode to always decode raw value into unicode
   [datakurre]
 
@@ -18,10 +21,6 @@ Changelog
   of sort order of imports
   [thet]
 
-- For Plone 5, support getting markup control panel settings from the registry,
-  while still supporting normal portal_properties access for Plone < 5.
-  [thet]
-
 
 1.2.4 (2014-10-20)
 ------------------
diff --git a/plone/app/textfield/field.rst b/plone/app/textfield/field.rst
index c6f8d54..d228481 100644
--- a/plone/app/textfield/field.rst
+++ b/plone/app/textfield/field.rst
@@ -115,6 +115,16 @@ Or to get the value encoded:
     >>> value.raw_encoded
     'Some plain text'
 
+Values are equal as long as they have the same `raw`, `mimeType`, `outputMimeType`,
+and `encoding`:
+
+    >>> value == RichTextValue(raw=u"Some plain text",
+    ...                        mimeType='text/plain',
+    ...                        outputMimeType=field.output_mime_type,
+    ...                        encoding='utf-8')
+    True
+
+
 Converting a value from unicode
 -------------------------------
 
diff --git a/plone/app/textfield/value.py b/plone/app/textfield/value.py
index 025ebb1..f70cc2b 100644
--- a/plone/app/textfield/value.py
+++ b/plone/app/textfield/value.py
@@ -19,6 +19,11 @@ def __init__(self, value):
     def __repr__(self):
         return u"<RawValueHolder: %s>" % self.value
 
+    def __eq__(self, other):
+        if not isinstance(other, RawValueHolder):
+            return NotImplemented
+        return self.value == other.value
+
 
 class RichTextValue(object):
     """The actual value.
@@ -98,3 +103,8 @@ def output_relative_to(self, context):
     def __repr__(self):
         return u"RichTextValue object. (Did you mean <attribute>.raw or "\
                u"<attribute>.output?)"
+
+    def __eq__(self, other):
+        if not isinstance(other, RichTextValue):
+            return NotImplemented
+        return vars(self) == vars(other)




-------------------------------------------------------------------------------


More information about the Testbot mailing list