Commits

xiaq committed 2c07f87 Merge

Automated merge with http://hg.moinmo.in/moin/2.0

Comments (0)

Files changed (4)

MoinMoin/security/__init__.py

 from MoinMoin.constants import rights
 from MoinMoin import user
 from MoinMoin.i18n import _, L_, N_
+from MoinMoin.util.pysupport import AutoNe
 
 
 def require_permission(permission):
         raise AttributeError(attr)
 
 
-class AccessControlList(object):
+class AccessControlList(AutoNe):
     """
     Access Control List - controls who may do what.
 
     def __eq__(self, other):
         return self.acl_lines == other.acl_lines
 
-    def __ne__(self, other):
-        return self.acl_lines != other.acl_lines
-
 
 class ACLStringIterator(object):
     """ Iterator for acl string

MoinMoin/util/iri.py

 
 import codecs
 import re
+from MoinMoin.util.pysupport import AutoNe
 
 
 def _iriquote_replace(exc):
 codecs.register_error('iriquote', _iriquote_replace)
 
 
-class Iri(object):
+class Iri(AutoNe):
     __slots__ = '_scheme', '_authority', '_path', '_query', '_fragment'
 
     overall_rules = r"""
 
         return NotImplemented
 
-    def __ne__(self, other):
-        ret = self.__eq__(other)
-        if ret is NotImplemented:
-            return ret
-        return not ret
-
     def __repr__(self):
         return '{0}(scheme={1!r}, authority={2!r}, path={3!r}, query={4!r}, fragment={5!r})'.format(
                 self.__class__.__name__,
         return self._quote(self, url=True)
 
 
-class IriAuthority(object):
+class IriAuthority(AutoNe):
     authority_rules = r"""
     ^
     (
                     self.port == other.port
         return NotImplemented
 
-    def __ne__(self, other):
-        ret = self.__eq__(other)
-        if ret is NotImplemented:
-            return ret
-        return not ret
-
     def __nonzero__(self):
         if self._userinfo or self._host or self.port:
             return True
     pass
 
 
-class IriPath(object):
+class IriPath(AutoNe):
     __slots__ = '_list'
 
     def __init__(self, iri_path=None, _quoted=True):
             return self._list == other._list
         return NotImplemented
 
-    def __ne__(self, other):
-        ret = self.__eq__(other)
-        if ret is NotImplemented:
-            return ret
-        return not ret
-
     def __getitem__(self, key):
         ret = self._list[key]
         if isinstance(key, slice):

MoinMoin/util/mime.py

 
 
 from collections import namedtuple
+from MoinMoin.util.pysupport import AutoNe
 
-class Type(namedtuple('Type', 'type subtype parameters')):
+class Type(namedtuple('Type', 'type subtype parameters'), AutoNe):
     """
     :ivar type: Type part
     :type type: unicode
 
         return NotImplemented
 
-    def __ne__(self, other):
-        ret = self.__eq__(other)
-        if ret is NotImplemented:
-            return ret
-        return not ret
-
     def __unicode__(self):
         ret = [u'{0}/{1}'.format(self.type or '*', self.subtype or '*')]
 

MoinMoin/util/pysupport.py

             lock.release()
 
     return decorated
+
+
+class AutoNe(object):
+    """
+    Implement __ne__ in terms of __eq__. This is a mixin class.
+    """
+    def __ne__(self, other):
+        ret = self.__eq__(other)
+        if ret is NotImplemented:
+            return ret
+        return not ret
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.