projects
/
feedingit
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix typo accessing woodchuck handle.
[feedingit]
/
src
/
opml.py
diff --git
a/src/opml.py
b/src/opml.py
index
552dcc3
..
914fd38
100644
(file)
--- a/
src/opml.py
+++ b/
src/opml.py
@@
-31,6
+31,8
@@
import gobject
import time
from os.path import isfile, dirname
import gobject
import time
from os.path import isfile, dirname
import gobject
+import logging
+logger = logging.getLogger(__name__)
class ExportOpmlData():
def __init__(self, parent, listing):
class ExportOpmlData():
def __init__(self, parent, listing):
@@
-50,9
+52,9
@@
class ExportOpmlData():
response = dialog.run()
dialog.hide()
if response == gtk.RESPONSE_OK:
response = dialog.run()
dialog.hide()
if response == gtk.RESPONSE_OK:
- filename = dialog.get_filename()
- print filename
- try:
+ filename = dialog.get_filename()
+ logger.debug("ExportOpmlData: %s" % filename)
+ #try:
cont = True
if isfile(filename):
cont = True
if isfile(filename):
@@
-71,13
+73,13
@@
class ExportOpmlData():
file.write(self.getOpmlText(listing))
file.close()
note = "Feeds exported to %s" %filename
file.write(self.getOpmlText(listing))
file.close()
note = "Feeds exported to %s" %filename
- except:
+ #except:
note = "Failed to export feeds"
note = "Failed to export feeds"
- dialog.destroy()
- dialog = hildon.Note ("information", parent, note , gtk.STOCK_DIALOG_INFO )
- dialog.run()
- dialog.destroy()
+ #dialog.destroy()
+ #dialog = hildon.Note ("information", parent, note , gtk.STOCK_DIALOG_INFO )
+ #dialog.run()
+ #dialog.destroy()
elif response == gtk.RESPONSE_CANCEL:
dialog.destroy()
elif response == gtk.RESPONSE_CANCEL:
dialog.destroy()
@@
-94,9
+96,14
@@
class ExportOpmlData():
title = listing.getFeedTitle(key)
url = listing.getFeedUrl(key)
if not title == "Archived Articles":
title = listing.getFeedTitle(key)
url = listing.getFeedUrl(key)
if not title == "Archived Articles":
- opml_text += """\n\t\t<outline type="rss" text="%s" title="%s" xmlUrl="%s"/>""" % (title, title, url)
+ opml_text += """\n\t\t<outline type="rss" text="%s" title="%s" xmlUrl="%s"/>""" % (self.sanitize(title), self.sanitize(title), self.sanitize(url))
opml_text += """\n</body>\n</opml>\n"""
return opml_text
opml_text += """\n</body>\n</opml>\n"""
return opml_text
+
+ def sanitize(self, text):
+ from cgi import escape
+ return escape(text).encode('ascii', 'xmlcharrefreplace')
+
class GetOpmlData():
class GetOpmlData():
@@
-127,17
+134,17
@@
class GetOpmlData():
return []
def downloadFile(self):
return []
def downloadFile(self):
- dlg = gtk.Dialog("OPML Import", self.parent, gtk.DIALOG_DESTROY_WITH_PARENT,
- (gtk.STOCK_OK, gtk.RESPONSE_OK,
+ dlg = gtk.Dialog("Import OPML from web", self.parent, gtk.DIALOG_DESTROY_WITH_PARENT,
+ ('Import', gtk.RESPONSE_OK,
gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL))
gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL))
- lbl = gtk.Label("Enter the URL of the OPML file:")
- lbl.show()
- dlg.vbox.pack_start(lbl)
- entry = gtk.Entry()
+ hb = gtk.HBox(False, 5)
+ hb.pack_start(gtk.Label('URL:'), expand=False)
+ entry = hildon.Entry(0)
entry.set_text("http://")
entry.set_text("http://")
- entry.select_region(0,-1)
- entry.show()
- dlg.vbox.pack_start(entry, False)
+ entry.select_region(-1, -1)
+ hb.pack_start(entry, expand=True)
+ hb.show_all()
+ dlg.vbox.pack_start(hb, False)
resp = dlg.run()
url = entry.get_text()
resp = dlg.run()
url = entry.get_text()
@@
-268,7
+275,7
@@
class OpmlDialog(gtk.Dialog):
def showOpmlData(widget, parent, button):
dialog = GetOpmlData(parent)
def showOpmlData(widget, parent, button):
dialog = GetOpmlData(parent)
- print dialog.getData()
+ logger.debug("showOpmlData: %s" % dialog.getData())
#dialog.destroy()
if __name__ == "__main__":
#dialog.destroy()
if __name__ == "__main__":