summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGunnar Wrobel <wrobel@gentoo.org>2005-09-04 09:40:24 +0000
committerGunnar Wrobel <wrobel@gentoo.org>2005-09-04 09:40:24 +0000
commitee9f6ae707029a63bb839674dbac3f82c3c3199d (patch)
tree7422fe7576fba663a3ca9dec8ae8d677b2c9e2e6 /www-apps/pyblosxom-plugins/files
parentFixed digests (diff)
downloadoverlay-ee9f6ae707029a63bb839674dbac3f82c3c3199d.tar.gz
overlay-ee9f6ae707029a63bb839674dbac3f82c3c3199d.tar.bz2
overlay-ee9f6ae707029a63bb839674dbac3f82c3c3199d.zip
contact plugin fix
svn path=/; revision=339
Diffstat (limited to 'www-apps/pyblosxom-plugins/files')
-rw-r--r--www-apps/pyblosxom-plugins/files/contact.py21
1 files changed, 15 insertions, 6 deletions
diff --git a/www-apps/pyblosxom-plugins/files/contact.py b/www-apps/pyblosxom-plugins/files/contact.py
index cd0808f..7e30cf2 100644
--- a/www-apps/pyblosxom-plugins/files/contact.py
+++ b/www-apps/pyblosxom-plugins/files/contact.py
@@ -21,10 +21,10 @@ Dependencies:
- My compatibility plugin if you're not using pyblosxom 1.2+.
-$Id: contact.py,v 1.3 2005/02/27 22:56:21 sar Exp $
+$Id: contact.py,v 1.6 2005/08/25 13:21:48 sar Exp $
"""
__author__ = "Steven Armstrong <sa at c-area dot ch>"
-__version__ = "$Revision: 1.3 $ $Date: 2005/02/27 22:56:21 $"
+__version__ = "$Revision: 1.6 $ $Date: 2005/08/25 13:21:48 $"
__url__ = "http://www.c-area.ch/code/"
__description__ = "Provides a form to send an email to the blog-owner."
__license__ = "GPL 2+"
@@ -102,6 +102,16 @@ class ContactRenderer(Renderer):
def render(self, header=1):
config = self._request.getConfiguration()
data = self._request.getData()
+
+ # root_datadir is normaly set after the cb_pathinfo callback.
+ # but if a plugin implements cb_handle (as this one does),
+ # cb_pathinfo is never called.
+ # if root_datadir is not set and flavourdir is not set in config.py
+ # an exception is thrown in BlosxomRenderer._getFlavour.
+ # so set root_datadir here explicitly to prevent that.
+ if not 'root_datadir' in data:
+ data['root_datadir'] = config['datadir']
+
# initialize flavour
self.flavour = self._getFlavour(data.get('flavour', 'html'))
data['content-type'] = self.flavour['content_type'].strip()
@@ -221,7 +231,8 @@ Subject: %(subject)s
)
smtp.quit()
except:
- tools.log_exception()
+ if hasattr(tools, "log_exception"):
+ tools.log_exception()
return (False, "Error: Problem sending email.")
else:
return (True, "Thanks for feeding my mailbox ;-)")
@@ -261,6 +272,7 @@ def cb_handle(args):
def cb_end(args):
+ # cleanup
request = args['request']
data = request.getData()
if INIT_KEY in data:
@@ -268,6 +280,3 @@ def cb_end(args):
if MESSAGE_KEY in data:
del data[MESSAGE_KEY]
-
-
-