[Checkins] SVN: lovely.tag/trunk/ Changed a bit the CHANGES.txt text that was obviously not good english ! Also removed the use of the from_brain classmethod that was in the first step added to be sure we didn't break anything. All tests pass, of course :)

Souheil CHELFOUH souheil at chelfouh.com
Thu Sep 24 12:45:26 EDT 2009


Log message for revision 104494:
  Changed a bit the CHANGES.txt text that was obviously not good english ! Also removed the use of the from_brain classmethod that was in the first step added to be sure we didn't break anything. All tests pass, of course :)

Changed:
  U   lovely.tag/trunk/CHANGES.txt
  U   lovely.tag/trunk/src/lovely/tag/engine.py
  U   lovely.tag/trunk/src/lovely/tag/tag.py

-=-
Modified: lovely.tag/trunk/CHANGES.txt
===================================================================
--- lovely.tag/trunk/CHANGES.txt	2009-09-24 16:34:02 UTC (rev 104493)
+++ lovely.tag/trunk/CHANGES.txt	2009-09-24 16:45:26 UTC (rev 104494)
@@ -5,10 +5,12 @@
 1.1.0 (unreleased)
 ------------------
 
-- Fixed error on tag handling in update : tag where registered more
-  than once for same user, item and tag  as with set what imports is
-  hash and not cmp. Added a test to put this in evidence with
-  getCloud. [trollfot]
+- Fixed an important error on the tag update handling : tags were
+  registered more than once if an update was made for the same user,
+  item and tag. The issue came from the set comparison method, that
+  uses the hash and not a classical cmp method. We had to introduce a
+  comparison basis we called "brain" in order to get the expected
+  behavior. A test was added to emphasis this behavior. [trollfot]
 
 
 1.0.0 (2009-07-24)

Modified: lovely.tag/trunk/src/lovely/tag/engine.py
===================================================================
--- lovely.tag/trunk/src/lovely/tag/engine.py	2009-09-24 16:34:02 UTC (rev 104493)
+++ lovely.tag/trunk/src/lovely/tag/engine.py	2009-09-24 16:45:26 UTC (rev 104494)
@@ -104,7 +104,7 @@
         
         add_tag_ids = []
         for tagBrain in add_tags:
-            tagObj = tag.Tag.from_brain(tagBrain)
+            tagObj = tag.Tag(*tagBrain)
             id = self._add(tagObj)
             add_tag_ids.append(id)
             ids = self._user_to_tagids.get(user)
@@ -287,7 +287,6 @@
         return '<%s entries=%i>' %(self.__class__.__name__,
                                    len(self._tagid_to_obj))
 
-
     def cleanStaleItems(self):
         """clean out stale items which have no associated object"""
         intIds = zope.component.getUtility(IIntIds, context=self)
@@ -325,9 +324,9 @@
                 count += self.rename(name, newName)
         return count
 
+
 @component.adapter(IIntIdRemovedEvent)
 def removeItemSubscriber(event):
-    
     """A subscriber to IntIdRemovedEvent which removes an item from
     the tagging engine"""
     ob = event.object

Modified: lovely.tag/trunk/src/lovely/tag/tag.py
===================================================================
--- lovely.tag/trunk/src/lovely/tag/tag.py	2009-09-24 16:34:02 UTC (rev 104493)
+++ lovely.tag/trunk/src/lovely/tag/tag.py	2009-09-24 16:45:26 UTC (rev 104494)
@@ -52,10 +52,6 @@
         """ representation to build sets"""
         return (self.item, self.user, self.name)
 
-    @classmethod
-    def from_brain(cls, brain):
-        return cls(*brain)
-
     def __repr__(self):
         return '<%s %r for %i by %r>' %(
             self.__class__.__name__, self.name, self.item, self.user)



More information about the checkins mailing list