conduit r1223 - in trunk: . conduit/datatypes conduit/modules



Author: jstowers
Date: Tue Jan 15 13:10:39 2008
New Revision: 1223
URL: http://svn.gnome.org/viewvc/conduit?rev=1223&view=rev

Log:
2008-01-16  John Carr <john carr unrouted co uk>

	* conduit/datatypes/DataType.py: Use rid instead of hash when testing
	if two datatypes are equal
	
	* conduit/modules/TomboyModule.py: Add a string.partition alternative for
	those people using Python 2.4



Modified:
   trunk/ChangeLog
   trunk/conduit/datatypes/DataType.py
   trunk/conduit/modules/TomboyModule.py

Modified: trunk/conduit/datatypes/DataType.py
==============================================================================
--- trunk/conduit/datatypes/DataType.py	(original)
+++ trunk/conduit/datatypes/DataType.py	Tue Jan 15 13:10:39 2008
@@ -56,7 +56,7 @@
         """
         log.debug("COMPARE: %s <----> %s " % (self.get_UID(), B.get_UID()))
 
-        if self.get_hash() == B.get_hash():
+        if self.get_rid() == B.get_rid():
             return conduit.datatypes.COMPARISON_EQUAL
 
         mtime1 = self.get_mtime()

Modified: trunk/conduit/modules/TomboyModule.py
==============================================================================
--- trunk/conduit/modules/TomboyModule.py	(original)
+++ trunk/conduit/modules/TomboyModule.py	Tue Jan 15 13:10:39 2008
@@ -19,12 +19,21 @@
 	"TomboyNoteConverter" :     { "type": "converter"       }
 }
 
+def partition(txt, sep):
+    try:
+        return txt.partition(sep)
+    except:
+        if not sep in txt:
+            return (txt, '', '')
+        else:
+            return (txt[:txt.find(sep)], sep, txt[txt.find(sep)+len(sep):])
+
 class TomboyNote(Note.Note):
     def __init__(self, title, xmlContent):
         self.xmlContent = xmlContent
         #strip the xml
         text = xmlContent.replace('<note-content version="0.1">','').replace('</note-content>','')
-        title, sep, contents = text.partition("\n")
+        title, sep, contents = partition(text, "\n")
         Note.Note.__init__(self, title, contents)
         
     def get_xml(self):
@@ -111,7 +120,7 @@
         log.debug("Getting note: %s" % uid)
         xmlContent=str(self.remoteTomboy.GetNoteContentsXml(uid))
         xmlContent=xmlContent.replace('<note-content version="0.1">','').replace('</note-content>','')
-        title, sep, contents = xmlContent.partition("\n")
+        title, sep, contents = partition(xmlContent, "\n")
         n = Note.Note(
                 title=title,
                 contents=contents



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]