conduit r1394 - in trunk: . conduit/modules



Author: jstowers
Date: Wed Mar 26 09:59:31 2008
New Revision: 1394
URL: http://svn.gnome.org/viewvc/conduit?rev=1394&view=rev

Log:
2008-03-26  John Stowers  <john stowers gmail com>

	* conduit/modules/TestModule.py: Disable annoying SimpleFactory test
	
	* conduit/modules/TomboyModule.py: Replace slashes in note titles with
	underscores. Fixes #524451



Modified:
   trunk/ChangeLog
   trunk/conduit/modules/TestModule.py
   trunk/conduit/modules/TomboyModule.py

Modified: trunk/conduit/modules/TestModule.py
==============================================================================
--- trunk/conduit/modules/TestModule.py	(original)
+++ trunk/conduit/modules/TestModule.py	Wed Mar 26 09:59:31 2008
@@ -38,7 +38,7 @@
     "TestSinkNeedConfigure" :   { "type": "dataprovider" },
     "TestFactory" :             { "type": "dataprovider-factory" },
 #    "TestFactoryRemoval" :      { "type": "dataprovider-factory" },
-    "TestSimpleFactory" :       { "type": "dataprovider-factory" },
+#    "TestSimpleFactory" :       { "type": "dataprovider-factory" },
     "TestConverter" :           { "type": "converter" }
 }
 

Modified: trunk/conduit/modules/TomboyModule.py
==============================================================================
--- trunk/conduit/modules/TomboyModule.py	(original)
+++ trunk/conduit/modules/TomboyModule.py	Wed Mar 26 09:59:31 2008
@@ -1,6 +1,7 @@
 import dbus
 import dbus.glib
 import logging
+import string
 log = logging.getLogger("modules.Tomboy")
 
 import conduit
@@ -39,6 +40,7 @@
 
 class TomboyNoteConverter(TypeConverter.Converter):
     NOTE_EXTENSION = ".xml"
+    ILLEGAL_TITLE_CHARS = " /"
     def __init__(self):
         self.conversions =  {
                 "note,note/tomboy"  : self.note_to_tomboy_note,
@@ -59,9 +61,18 @@
         #Old tomboy made this note, fallback to plain text
         if content == None:
             content = note.get_contents()
+
+        #replace the following characters in the note
+        #title with an underscore
+        filename = note.get_title().translate(
+                                        string.maketrans(
+                                                self.ILLEGAL_TITLE_CHARS,
+                                                "_"*len(self.ILLEGAL_TITLE_CHARS)
+                                                )
+                                            ) 
         f = File.TempFile(content)
-        f.force_new_filename(note.get_title().replace(" ","_"))
-        f.force_new_file_extension(TomboyNoteConverter.NOTE_EXTENSION)
+        f.force_new_filename(filename)
+        f.force_new_file_extension(self.NOTE_EXTENSION)
         return f
         
     def file_to_tomboy_note(self, f, **kwargs):        



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