From 94b067a4535cd0a55bf79a5523688058a0509845 Mon Sep 17 00:00:00 2001 From: Thomas Leonard Date: Wed, 30 Dec 2009 21:38:16 +0000 Subject: [PATCH] If the feed's name is 'feed.xml', save the key to the parent directory This is for the case where your web-server layout is .../my-program/feed.xml and the feed's URL is http://.../my-program --- main.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index c7e02b9..9b7e914 100644 --- a/main.py +++ b/main.py @@ -545,7 +545,7 @@ class FeedEditor(loading.XDSLoader): self.key = key_model[key_menu.get_active()][0] def export_stylesheet_and_key(self): - dir = os.path.dirname(self.pathname) + dir = os.path.dirname(os.path.abspath(self.pathname)) stylesheet = os.path.join(dir, 'interface.xsl') if not os.path.exists(stylesheet): shutil.copyfile(stylesheet_src, stylesheet) @@ -553,6 +553,10 @@ class FeedEditor(loading.XDSLoader): "this to your web-server in the same directory as the feed file. " "This allows browsers to display the feed nicely." % stylesheet) + if os.path.abspath(self.pathname).endswith('/feed.xml'): + # Probably the feed's URL is the directory, so we'll get the key from the parent. + dir = os.path.dirname(dir) + exported = signing.export_key(dir, self.key) if exported: rox.info("I have exported your public key as '%s'. You should upload " -- 2.11.4.GIT