summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGunnar Wrobel <wrobel@gentoo.org>2006-08-29 06:37:21 +0000
committerGunnar Wrobel <wrobel@gentoo.org>2006-08-29 06:37:21 +0000
commit1426aab6305d9e265890f67d22670ecbfa0810ee (patch)
tree20b7b2909fb374edecf9c46b75c51701592eddb4 /www-apps
parentUpdated autoprimeweb (diff)
downloadoverlay-1426aab6305d9e265890f67d22670ecbfa0810ee.tar.gz
overlay-1426aab6305d9e265890f67d22670ecbfa0810ee.tar.bz2
overlay-1426aab6305d9e265890f67d22670ecbfa0810ee.zip
Code fixes for the pyblosxom plugins (taken from the plugin release 1.3.0)
svn path=/stable/; revision=754
Diffstat (limited to 'www-apps')
-rw-r--r--www-apps/pyblosxom-plugins/Manifest78
-rw-r--r--www-apps/pyblosxom-plugins/files/comments.py268
-rw-r--r--www-apps/pyblosxom-plugins/files/digest-pyblosxom-plugins-1.3.21
-rw-r--r--www-apps/pyblosxom-plugins/files/logrequest.py2
-rw-r--r--www-apps/pyblosxom-plugins/files/pyarchives.py2
-rw-r--r--www-apps/pyblosxom-plugins/files/pycalendar.py8
-rw-r--r--www-apps/pyblosxom-plugins/files/pycategories.py45
7 files changed, 277 insertions, 127 deletions
diff --git a/www-apps/pyblosxom-plugins/Manifest b/www-apps/pyblosxom-plugins/Manifest
index a8709b2..30013fe 100644
--- a/www-apps/pyblosxom-plugins/Manifest
+++ b/www-apps/pyblosxom-plugins/Manifest
@@ -1,21 +1,87 @@
+AUX blocks.py 6567 RMD160 471467203f5f06cc9e48898f1f26aa6781593386 SHA1 b5c6cd8ee99acaaef2d5ceb1294c9893f26294cb SHA256 ff6b9848689b897a280580305901f1295ea1d4abe7484d098b83d9de0f1c622a
MD5 f67ef44f565d2cfa49ce8e728267081b files/blocks.py 6567
+RMD160 471467203f5f06cc9e48898f1f26aa6781593386 files/blocks.py 6567
+SHA256 ff6b9848689b897a280580305901f1295ea1d4abe7484d098b83d9de0f1c622a files/blocks.py 6567
+AUX commentAPI.py 5425 RMD160 9248f1589cecb46f98fdee67496497421c0b1758 SHA1 ef65259db464ee25e6fe62cf01a50fec5f292f77 SHA256 74034d87f0283c9e51c56f8fae0cbb19c8a46727adad191870bf895dd3b89367
MD5 d4a9d94b9c5eff48ee20510177e22730 files/commentAPI.py 5425
-MD5 2c50c784d62838e41c3a0b596f9a4160 files/comments.py 25332
+RMD160 9248f1589cecb46f98fdee67496497421c0b1758 files/commentAPI.py 5425
+SHA256 74034d87f0283c9e51c56f8fae0cbb19c8a46727adad191870bf895dd3b89367 files/commentAPI.py 5425
+AUX comments.py 27997 RMD160 550beff74a9b3ffeb69c24e03101cdb870d8bf13 SHA1 30f1ed4f86b12d8c56c9c6941bf6df08d380cbec SHA256 7538219d1a3375f9b060a5143c12ab256a5fc538b8547b5b326a15a73448085d
+MD5 a0042cd68bff64caae88389166341405 files/comments.py 27997
+RMD160 550beff74a9b3ffeb69c24e03101cdb870d8bf13 files/comments.py 27997
+SHA256 7538219d1a3375f9b060a5143c12ab256a5fc538b8547b5b326a15a73448085d files/comments.py 27997
+AUX contact.py 11517 RMD160 4960e767fd4b1c07cdd8c10c2dda73edf2ec0b3a SHA1 9a78e98571d639127a06ef6785f30cb1acac47e0 SHA256 7ea7ac0f5f01d7639b0856fbd3c8dcaf8d1c1a3930b9d22b4709d570c031c061
MD5 53cf6af3d39e1d47a4d26d20dbe4338b files/contact.py 11517
-MD5 d41d8cd98f00b204e9800998ecf8427e files/digest-pyblosxom-plugins-1.3.2 0
+RMD160 4960e767fd4b1c07cdd8c10c2dda73edf2ec0b3a files/contact.py 11517
+SHA256 7ea7ac0f5f01d7639b0856fbd3c8dcaf8d1c1a3930b9d22b4709d570c031c061 files/contact.py 11517
+AUX getstamps.py 1332 RMD160 8a291671ea8da913f812661af5deda00d3cc7629 SHA1 cff9e96bf037b03def42f5931d38b7f223d39b08 SHA256 43c4dbf41acc434c9793c256fef7c9567b4fd21a035da290c40b6e82cb5aec63
MD5 ef8b9559c56fe3bff0bf15672c2239e4 files/getstamps.py 1332
+RMD160 8a291671ea8da913f812661af5deda00d3cc7629 files/getstamps.py 1332
+SHA256 43c4dbf41acc434c9793c256fef7c9567b4fd21a035da290c40b6e82cb5aec63 files/getstamps.py 1332
+AUX hardcodedates.py 2036 RMD160 33fcdcbf683b55aa7436f002bf17f72269502e10 SHA1 e41b0fa2c2d769534ecf20406bab64bda25749c4 SHA256 045c3b6656890d8e7ffd37bb466945c47984f3bcaaeb981a671f7eae5c8ad561
MD5 3ae49161534556018d226f514ef68195 files/hardcodedates.py 2036
-MD5 13427211867bdf6231ec8d9ab1a585cc files/logrequest.py 2248
+RMD160 33fcdcbf683b55aa7436f002bf17f72269502e10 files/hardcodedates.py 2036
+SHA256 045c3b6656890d8e7ffd37bb466945c47984f3bcaaeb981a671f7eae5c8ad561 files/hardcodedates.py 2036
+AUX logrequest.py 2243 RMD160 803bab5cd284e2bf0f5f08118d35a652498e941e SHA1 5eb4fe2a48d2d4be14ee2904389231aa0fd9beb1 SHA256 f36a68d3fec56edfbf1ffd72286ff6016aab1f39c5d4917144b64cea0d69f945
+MD5 b747c8222500873674623aafa913288b files/logrequest.py 2243
+RMD160 803bab5cd284e2bf0f5f08118d35a652498e941e files/logrequest.py 2243
+SHA256 f36a68d3fec56edfbf1ffd72286ff6016aab1f39c5d4917144b64cea0d69f945 files/logrequest.py 2243
+AUX nospam.py 6364 RMD160 1b2a0a53b2ef602ccb5c2865c50e31ccf094b8e3 SHA1 341f17ac26e3dcf42f669b3ffdb7c8ab5ea7f08b SHA256 32c514e246f3026c12a5c4238bfe39c854bbfcd607a2d5fd1e217e0f6c214d78
MD5 3a489e93c5a569beaff1aeba02b6dc20 files/nospam.py 6364
-MD5 2a797ba4c445b019c86dc4b369d7a0a1 files/pyarchives.py 3695
-MD5 7d5a2778c5204601c56172c3c34109f3 files/pycalendar.py 9856
-MD5 d30d5cf286b0a3bfb42f1af7029854fc files/pycategories.py 7740
+RMD160 1b2a0a53b2ef602ccb5c2865c50e31ccf094b8e3 files/nospam.py 6364
+SHA256 32c514e246f3026c12a5c4238bfe39c854bbfcd607a2d5fd1e217e0f6c214d78 files/nospam.py 6364
+AUX pyarchives.py 3695 RMD160 5f59580e2f1921de2773237b915d48c1fb5b2b33 SHA1 eb8bcf4ef7f1c6388aa840aead8d5556563e9249 SHA256 e1be10662e597b5182cf25430b2760104827dfb7c427a98ed2e4d87b366bf858
+MD5 4ea9d10d19c429f59a3025092033631e files/pyarchives.py 3695
+RMD160 5f59580e2f1921de2773237b915d48c1fb5b2b33 files/pyarchives.py 3695
+SHA256 e1be10662e597b5182cf25430b2760104827dfb7c427a98ed2e4d87b366bf858 files/pyarchives.py 3695
+AUX pycalendar.py 9720 RMD160 faa1cbc530b2fface679441b442d5e02003bcdf1 SHA1 3926757e9cdad4ae9890c675e8d4709adcbe24dc SHA256 1e75479935b91cdd738beabafe1f8846b4062dc5491be544a8d498ac948c5435
+MD5 a99d4c73f698a596cd36126e9ab11d47 files/pycalendar.py 9720
+RMD160 faa1cbc530b2fface679441b442d5e02003bcdf1 files/pycalendar.py 9720
+SHA256 1e75479935b91cdd738beabafe1f8846b4062dc5491be544a8d498ac948c5435 files/pycalendar.py 9720
+AUX pycategories.py 8416 RMD160 4d094f13e0ddcc86e9ca42eaba42704258c4aa67 SHA1 ef9604ae96b91686c1780747ee1c98fb8c8c0be7 SHA256 b62d333ffc10bf6ba8fa029515ea2351ac93df25bf8f310982952a4611025fbc
+MD5 f88e17ff8a6077fe6aa92252bbe5c007 files/pycategories.py 8416
+RMD160 4d094f13e0ddcc86e9ca42eaba42704258c4aa67 files/pycategories.py 8416
+SHA256 b62d333ffc10bf6ba8fa029515ea2351ac93df25bf8f310982952a4611025fbc files/pycategories.py 8416
+AUX pyguest.py 10951 RMD160 0b2bdde2b22f8c168866db59a65338d436ee68ea SHA1 2697b37e9c8ae54527b23dc1c862fe9f3185b17b SHA256 128b119bf2e1ba91acf2e754b64e498371733915954edf98b5ee9f76dd0f523c
MD5 dad8289c1e561ffec042f661873e4ed4 files/pyguest.py 10951
+RMD160 0b2bdde2b22f8c168866db59a65338d436ee68ea files/pyguest.py 10951
+SHA256 128b119bf2e1ba91acf2e754b64e498371733915954edf98b5ee9f76dd0f523c files/pyguest.py 10951
+AUX rss2renderer.py 8779 RMD160 3375174293457023da6679583375b8d1852c0425 SHA1 ce386cdb067fa400c8ff0ee62d7dae39ccef6e3d SHA256 6daa1b9f8a7cca0c25c0f07fba8bfd189eb6be429bf32a6f92cc607890e2fbb0
MD5 b0462630303ce00d3356062868299bce files/rss2renderer.py 8779
+RMD160 3375174293457023da6679583375b8d1852c0425 files/rss2renderer.py 8779
+SHA256 6daa1b9f8a7cca0c25c0f07fba8bfd189eb6be429bf32a6f92cc607890e2fbb0 files/rss2renderer.py 8779
+AUX rss2renderer.py.html 41245 RMD160 676cc519b147cfe1f7e5a9f9230290d129013e1e SHA1 ec2316cf1fa407d04e9509723d2ef005e3a7feb9 SHA256 0068e903af1c24a4b3b5746f4ec1fdcde58e0ebac49c0e70e14157939436722b
MD5 551595972432681869214de6b21dc0aa files/rss2renderer.py.html 41245
+RMD160 676cc519b147cfe1f7e5a9f9230290d129013e1e files/rss2renderer.py.html 41245
+SHA256 0068e903af1c24a4b3b5746f4ec1fdcde58e0ebac49c0e70e14157939436722b files/rss2renderer.py.html 41245
+AUX session.py 11214 RMD160 984b37b2af0b1d0fbc36a20afbca9f4c791851e6 SHA1 cf7a535cbb107d6584988fd61286e531077e3933 SHA256 5ddaf09d2ab10aa4be4563fa994a03c083c40718f24dfa411ce8ed801c27bc3e
MD5 9d08ee37ee648e2e1541b51333db0fe6 files/session.py 11214
+RMD160 984b37b2af0b1d0fbc36a20afbca9f4c791851e6 files/session.py 11214
+SHA256 5ddaf09d2ab10aa4be4563fa994a03c083c40718f24dfa411ce8ed801c27bc3e files/session.py 11214
+AUX trackback.py 4603 RMD160 d77cdff3c828102a45fc28ba8380ee6358f761ab SHA1 0ca427e167e4330a7e84301dd0b4ed32076028f9 SHA256 b9674895c9c2a58301336303c058f38a4c37a7a4fa9ebb24a6beace3728a3533
MD5 d39794b25ac69bcced9f27be23cea81c files/trackback.py 4603
+RMD160 d77cdff3c828102a45fc28ba8380ee6358f761ab files/trackback.py 4603
+SHA256 b9674895c9c2a58301336303c058f38a4c37a7a4fa9ebb24a6beace3728a3533 files/trackback.py 4603
+AUX wbglast10summary.py 1094 RMD160 744da4a8d50d0c3f237c351d67768a0f6fdfc484 SHA1 e3e2152fe4122dfcc689cada62cbfb7057f0b7d6 SHA256 70626118205feb6605ee685ab2b64d23b9fe0cd3d1e49b11fef2257710afb7d9
MD5 2fcbddb5246ec1f79ec0557cbe56bdad files/wbglast10summary.py 1094
+RMD160 744da4a8d50d0c3f237c351d67768a0f6fdfc484 files/wbglast10summary.py 1094
+SHA256 70626118205feb6605ee685ab2b64d23b9fe0cd3d1e49b11fef2257710afb7d9 files/wbglast10summary.py 1094
+AUX wbglast10summary.py.html 4862 RMD160 99bf4333b6060623f35ba7c54ebbf96ee3c6d29b SHA1 b524f51babf3e46140389b26da0d83fa016bcda9 SHA256 d8d21cea6fe99cb5cf09f7088271cbf10ead406ffb718680d1d0dc66b8f19d9f
MD5 1bd704ad5a8e5fd621b84a6ab2ec9d32 files/wbglast10summary.py.html 4862
+RMD160 99bf4333b6060623f35ba7c54ebbf96ee3c6d29b files/wbglast10summary.py.html 4862
+SHA256 d8d21cea6fe99cb5cf09f7088271cbf10ead406ffb718680d1d0dc66b8f19d9f files/wbglast10summary.py.html 4862
+AUX xmlrpc_pingback.py 5696 RMD160 5454bc762bdf5e4bfc41e1a7600f7487de4111e0 SHA1 028db5a5e92594954b64d7da64972e9b57537f56 SHA256 c71abde791d91e0ebabbc52af83a2704b74429f7fbb18ec3441c8d7a9688d876
MD5 9d1afb745bb12ea8b1ab7a2ab2be7e6a files/xmlrpc_pingback.py 5696
+RMD160 5454bc762bdf5e4bfc41e1a7600f7487de4111e0 files/xmlrpc_pingback.py 5696
+SHA256 c71abde791d91e0ebabbc52af83a2704b74429f7fbb18ec3441c8d7a9688d876 files/xmlrpc_pingback.py 5696
+EBUILD pyblosxom-plugins-1.3.2.ebuild 1128 RMD160 75561d056473acfcf34d3e22ed2a54ebef205ad6 SHA1 7806a8ab9dfd588c4373c458fd50efac2d6c23e3 SHA256 2d8cfa1f7235c0798b52a73b5dbcd9d028415ff46a45935b977b2cb25ded1437
MD5 3a1cd48b2ee5f5175cf74f8ad606ad13 pyblosxom-plugins-1.3.2.ebuild 1128
+RMD160 75561d056473acfcf34d3e22ed2a54ebef205ad6 pyblosxom-plugins-1.3.2.ebuild 1128
+SHA256 2d8cfa1f7235c0798b52a73b5dbcd9d028415ff46a45935b977b2cb25ded1437 pyblosxom-plugins-1.3.2.ebuild 1128
+MISC trac.BAK 135 RMD160 a0176def7e99c80344eee0a78e0e5ef4886255ad SHA1 8d33f26243a6b05b91b8aeb67bd219030785f94e SHA256 fc951abe2f3dad748fab09d07ba7e9ac1d20d8c9da0d68e12ce68aa07d1156c3
+MD5 890d871165b6e92e46908e5f49b37216 trac.BAK 135
+RMD160 a0176def7e99c80344eee0a78e0e5ef4886255ad trac.BAK 135
+SHA256 fc951abe2f3dad748fab09d07ba7e9ac1d20d8c9da0d68e12ce68aa07d1156c3 trac.BAK 135
+MD5 68b329da9893e34099c7d8ad5cb9c940 files/digest-pyblosxom-plugins-1.3.2 1
+RMD160 c0da025038ed83c687ddc430da9846ecb97f3998 files/digest-pyblosxom-plugins-1.3.2 1
+SHA256 01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b files/digest-pyblosxom-plugins-1.3.2 1
diff --git a/www-apps/pyblosxom-plugins/files/comments.py b/www-apps/pyblosxom-plugins/files/comments.py
index 1d6b505..3632d70 100644
--- a/www-apps/pyblosxom-plugins/files/comments.py
+++ b/www-apps/pyblosxom-plugins/files/comments.py
@@ -10,52 +10,57 @@ Contributors:
Bill Mill
Roberto De Almeida
David Geller
+ David Pashley
If you make any changes to this plugin, please a send a patch with your
changes to twl+pyblosxom@sauria.com so that we can incorporate your changes.
Thanks!
-This plugin requires the PyXML module.
+Note: This plugin requires the PyXML module.
This module supports the following config parameters (they are not
required):
- comment_dir - the directory we're going to store all our comments in.
- this defaults to datadir + "comments".
- comment_ext - the file extension used to denote a comment file.
- this defaults to "cmt".
- comment_draft_ext - the file extension used for new comments that have
- not been manually approved by you. this defaults
- to comment_ext (i.e. there is no draft stage)
-
- comment_smtp_server - the smtp server to send comments notifications
- through.
- comment_smtp_from - the person comment notifications will be from.
- If you omit this, the from address will be the
- e-mail address as input in the comment form
- comment_smtp_to - the person to send comment notifications to.
- comment_nofollow - set this to 1 to add rel="nofollow" attributes to
- links in the description -- these attributes are embedded
- in the stored representation.
+ comment_dir - the directory we're going to store all our comments in.
+ this defaults to datadir + "comments".
+ comment_ext - the file extension used to denote a comment file.
+ this defaults to "cmt".
+ comment_draft_ext - the file extension used for new comments that have
+ not been manually approved by you. this defaults
+ to comment_ext (i.e. there is no draft stage)
+
+ comment_smtp_server - the smtp server to send comments notifications
+ through.
+ comment_smtp_from - the person comment notifications will be from.
+ If you omit this, the from address will be the
+ e-mail address as input in the comment form
+ comment_smtp_to - the person to send comment notifications to.
+ comment_nofollow - set this to 1 to add rel="nofollow" attributes to
+ links in the description -- these attributes are embedded
+ in the stored representation.
Comments are stored 1 per file in a parallel hierarchy to the datadir
hierarchy. The filename of the comment is the filename of the blog
entry, plus the creation time of the comment as a float, plus the
-comment extension. The contents of the comment file is an RSS 2.0
-formatted item.
+comment extension.
-Comments now follow the blog_encoding variable specified in config.py
+Comments now follow the blog_encoding variable specified in config.py .
+If you don't include a blog_encoding variable, this will default to
+iso-8859-1.
-Each entry has to have the following properties in order to work with
-comments:
+Comments will be shown for a given page if one of the following is
+true:
- 1. absolute_path - the category of the entry. ex. "dev/pyblosxom"
- 2. fn - the filename of the entry without the file extension and without
- the directory. ex. "staticrendering"
- 3. file_path - the absolute_path plus the fn. ex. "dev/pyblosxom/staticrendering"
+ 1. the page has only one blog entry on it and the request is for a
+ specific blog entry as opposed to a category with only one entry
+ in it
+
+ 2. if "showcomments=yes" is in the querystring then comments will
+ be shown
-Also, for any entry that you don't want to have comments, just add
-"nocomments" to the properties of the entry.
+
+IMPLEMENTING COMMENT PREVIEW
+============================
If you would like comment previews, you need to do 2 things.
@@ -79,11 +84,44 @@ If you would like comment previews, you need to do 2 things.
the available variables from the comment template are available for
this template.
+
+NOFOLLOW SUPPORT
+================
+
This plugin implements Google's nofollow support for links in the body of the
comment. If you display the link of the comment poster in your HTML template
then you must add the rel="nofollow" attribute to your template as well
+NOTE TO DEVELOPERS WHO ARE WRITING PLUGINS THAT CREATE COMMENTS
+===============================================================
+
+Each entry has to have the following properties in order to work with
+comments:
+
+ 1. absolute_path - the category of the entry.
+ ex. "dev/pyblosxom"
+ 2. fn - the filename of the entry without the file extension and without
+ the directory.
+ ex. "staticrendering"
+ 3. file_path - the absolute_path plus the fn.
+ ex. "dev/pyblosxom/staticrendering"
+
+Also, if you don't want comments for an entry, add "nocomments" = 1
+to the properties for the entry.
+
+
+WHERE TO FIND ADDITIONAL MATERIAL
+=================================
+
+There is a README file that comes with the contributed plugins pack
+in contrib/plugins/comments/ which has more information on installing
+the comments plugin.
+
+Additionally, there is a chapter in the PyBlosxom manual that
+covers installing and configuring the comments plugin. The manual
+is on the PyBlosxom web-site: http://pyblosxom.sourceforge.net/
+
Copyright (c) 2003-2005 Ted Leung
@@ -108,7 +146,9 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
"""
__author__ = "Ted Leung"
-__version__ = "$Id: comments.py,v 1.41.4.7 2005/06/10 13:58:29 willhelm Exp $"
+__version__ = "$Id: comments.py 893 2006-05-09 23:27:38Z willhelm $"
+__url__ = "http://pyblosxom.sourceforge.net/"
+__description__ = "Allows for comments on each blog entry."
import cgi, glob, os.path, re, time, cPickle, os, codecs
from xml.sax.saxutils import escape
@@ -118,10 +158,6 @@ from Pyblosxom.entries.base import EntryBase
def cb_start(args):
request = args["request"]
config = request.getConfiguration()
- logdir = config.get("logdir", "/tmp/")
-
- # logfile = os.path.normpath(logdir + os.sep + "comments.log")
- # tools.make_logger(logfile)
if not config.has_key('comment_dir'):
config['comment_dir'] = os.path.join(config['datadir'],'comments')
@@ -283,8 +319,8 @@ def readComment(filename, encoding):
cmt['cmt_pubDate'] = time.ctime(float(cmt['cmt_pubDate'])) #pretty time
return cmt
except: #don't error out on a bad comment
- # tools.log('bad comment file: %s' % filename)
- pass
+ logger = tools.getLogger()
+ logger.error("bad comment file: %s" % filename)
def writeComment(request, config, data, comment, encoding):
"""
@@ -302,20 +338,30 @@ def writeComment(request, config, data, comment, encoding):
@return: The success or failure of creating the comment.
@rtype: string
"""
+ entry_list = data.get("entry_list", [])
+ if not entry_list:
+ return "No such entry exists."
+
entry = data['entry_list'][0]
cdir = os.path.join(config['comment_dir'],entry['absolute_path'])
cdir = os.path.normpath(cdir)
if not os.path.isdir(cdir):
- os.makedirs(cdir, mode = 0775)
+ os.makedirs(cdir)
cfn = os.path.join(cdir,entry['fn']+"-"+comment['pubDate']+"."+config['comment_draft_ext'])
argdict = { "request": request, "comment": comment }
reject = tools.run_callback("comment_reject",
argdict,
- donefunc=lambda x:x)
- if reject == 1:
- return "Comment rejected."
+ donefunc=lambda x:x != 0)
+
+ if (isinstance(reject, tuple) or isinstance(reject, list)) and len(reject) == 2:
+ reject_code, reject_message = reject
+ else:
+ reject_code, reject_message = reject, "Comment rejected."
+
+ if reject_code == 1:
+ return reject_message
def makeXMLField(name, field):
return "<"+name+">" + cgi.escape(field.get(name, "")) + "</"+name+">\n";
@@ -323,6 +369,7 @@ def writeComment(request, config, data, comment, encoding):
filedata = '<?xml version="1.0" encoding="%s"?>\n' % encoding
filedata += "<item>\n"
filedata += makeXMLField('title', comment)
+ filedata += makeXMLField('ipaddress', comment)
filedata += makeXMLField('author', comment)
filedata += makeXMLField('link', comment)
filedata += makeXMLField('email', comment)
@@ -334,12 +381,12 @@ def writeComment(request, config, data, comment, encoding):
try :
cfile = codecs.open(cfn, "w", encoding)
except IOError:
- # tools.log("Couldn't open comment file %s for writing" % cfn)
+ logger = tools.getLogger()
+ logger.error("couldn't open comment file '%s' for writing" % cfn)
return "Internal error: Your comment could not be saved."
cfile.write(filedata)
cfile.close()
- os.chmod(cfn, 0664)
#write latest pickle
latest = None
@@ -347,18 +394,21 @@ def writeComment(request, config, data, comment, encoding):
try:
latest = open(latestFilename,"w")
except IOError:
- # tools.log("Couldn't open latest comment pickle for writing")
+ logger = tools.getLogger()
+ logger.error("couldn't open latest comment pickle for writing")
return "Couldn't open latest comment pickle for writing."
else:
modTime = float(comment['pubDate'])
try:
- cPickle.dump(modTime,latest)
+ cPickle.dump(modTime, latest)
latest.close()
except IOError:
- # should log or e-mail
if latest:
latest.close()
+
+ logger = tools.getLogger()
+ logger.error("comment may not have been saved to pickle file.")
return "Internal error: Your comment may not have been saved."
if config.has_key('comment_smtp_server') and \
@@ -391,43 +441,54 @@ def send_email(config, entry, comment, comment_dir, comment_filename):
@param comment_filename: file name of current comment
@type comment_filename: string
"""
- import smtplib, codecs
+ import smtplib
# import the formatdate function which is in a different
# place in Python 2.3 and up.
try:
from email.Utils import formatdate
except ImportError:
from rfc822 import formatdate
+ from socket import gethostbyaddr
author = escape_SMTP_commands(clean_author(comment['author']))
description = escape_SMTP_commands(comment['description'])
+ ipaddress = escape_SMTP_commands(comment.get('ipaddress', '?'))
+
if comment.has_key('email'):
- email = comment['email']
+ email = escape_SMTP_commands(clean_author(comment['email']))
else:
email = config['comment_smtp_from']
try:
- server = smtplib.SMTP(config['comment_smtp_server'])
- curl = config['base_url']+'/'+entry['file_path']
- comment_dir = os.path.join(config['comment_dir'], entry['absolute_path'])
-
- message = []
- message.append("From: %s" % email)
- message.append("To: %s" % config["comment_smtp_to"])
- message.append("Date: %s" % formatdate(float(comment['pubDate'])))
- message.append("Subject: write back by %s" % author)
- message.append("")
- message.append("%s\n%s\n%s\n" % (codecs.ascii_decode(description, 'ignore'),
- codecs.ascii_decode(comment_filename, 'ignore'),
- codecs.ascii_decode(curl, 'ignore')))
- server.sendmail(from_addr=email,
+ server = smtplib.SMTP(config['comment_smtp_server'])
+ curl = config['base_url']+'/'+entry['file_path']
+ comment_dir = os.path.join(config['comment_dir'], entry['absolute_path'])
+
+ message = []
+ message.append("From: %s" % email)
+ message.append("To: %s" % config["comment_smtp_to"])
+ message.append("Date: %s" % formatdate(float(comment['pubDate'])))
+ message.append("Subject: comment by %s" % author)
+ message.append("")
+ message.append("Name: %s" % author)
+ if comment.has_key('email'):
+ message.append("Email: %s" % comment['email'])
+ if comment.has_key('link'):
+ message.append("URL: %s" % comment['link'])
+ try:
+ message.append("Hostname: %s (%s)" % (gethostbyaddr(ipaddress)[0], ipaddress))
+ except:
+ message.append("IP: %s" % ipaddress)
+ message.append("Entry URL: %s" % curl)
+ message.append("Comment location: %s" % comment_filename)
+ message.append("\n\n%s" % description)
+ server.sendmail(from_addr=email,
to_addrs=config['comment_smtp_to'],
msg="\n".join(message))
- server.quit()
+ server.quit()
except Exception, e:
- #tools.log("Error sending mail: %s" % e)
- # FIXME - if we error out, no one will know.
- pass
+ logger = tools.getLogger()
+ logger.error("error sending email: %s" % e)
def clean_author(s):
"""
@@ -559,31 +620,61 @@ def cb_prepare(args):
form = request.getHttp()['form']
config = request.getConfiguration()
data = request.getData()
-
+ pyhttp = request.getHttp()
+
+ # first we check to see if we're going to print out comments
+
+ # the default is not to show comments
+ data['display_comment_default'] = 0
+
+ # check to see if they have "showcomments=yes" in the querystring
+ qstr = pyhttp.get('QUERY_STRING', None)
+ if qstr != None:
+ parsed_qs = cgi.parse_qs(qstr)
+ if parsed_qs.has_key('showcomments'):
+ if parsed_qs['showcomments'][0] == 'yes':
+ data['display_comment_default'] = 1
+
+ # check to see if the bl_type is "file"
+ if data.has_key("bl_type") and data["bl_type"] == "file":
+ data["bl_type_file"] = "yes"
+ data['display_comment_default'] = 1
+
+ # second, we check to see if they're posting a comment and we
+ # need to write the comment to disk.
if form.has_key("title") and form.has_key("author") and \
form.has_key("body") and not form.has_key("preview"):
- encoding = config['blog_encoding']
+ encoding = config.get('blog_encoding', 'iso-8859-1')
decode_form(form, encoding)
body = form['body'].value
-
+ author = form['author'].value
+ url = (form.has_key('url') and [form['url'].value] or [''])[0]
+
+ # sanitize incoming data
body = sanitize(body)
+ author = sanitize(author)
- # Check if the form has a URL
- url = (form.has_key('url') and [form['url'].value] or [''])[0]
-
- #it doesn't make sense to add nofollow to link here, but we should
- #escape it. If you don't like the link escaping, I'm not attached to it.
+ # it doesn't make sense to add nofollow to link here, but we should
+ # escape it. If you don't like the link escaping, I'm not attached
+ # to it.
cdict = {'title': form['title'].value, \
- 'author' : form['author'].value, \
+ 'author' : author, \
'pubDate' : str(time.time()), \
'link' : escape_link(url), \
'source' : '', \
'description' : add_dont_follow(body, config) }
+
+ keys = form.keys()
+ keys = [k for k in keys if k not in ["title", "url", "author", "body"]]
+ for k in keys:
+ cdict[k] = form[k].value
+
if form.has_key('email'):
cdict['email'] = form['email'].value
+ cdict['ipaddress'] = pyhttp.get('REMOTE_ADDR', '')
data["comment_message"] = writeComment(request, config, data, \
cdict, encoding)
@@ -594,28 +685,9 @@ def escape_link(linkstring):
return linkstring
def decode_form(d, encoding):
- for key in d:
+ for key in d.keys():
d[key].value = d[key].value.decode(encoding)
-def cb_pathinfo(args):
- request = args['request']
- data = request.getData()
- pyhttp = request.getHttp()
- qstr = pyhttp.get('QUERY_STRING', None)
-
- data['display_comment_default'] = 0
-
- if qstr == None:
- return None
-
- parsed_qs = cgi.parse_qs(qstr)
- if parsed_qs.has_key('showcomments'):
- if parsed_qs['showcomments'][0] == 'yes':
- data['display_comment_default'] = 1
-
- return None
-
-
def cb_head(args):
renderer = args['renderer']
template = args['template']
@@ -670,10 +742,10 @@ def build_preview_comment(form, entry):
except KeyError, e:
c['cmt_error'] = 'Missing value: %s' % e
- #optional fields
- if 'url' in form:
+ # optional fields
+ if form.has_key("url"):
c['cmt_link'] = form['url'].value
- if 'email' in form:
+ if form.has_key("email"):
c['cmt_email'] = form['email'].value
for key in c: entry[key] = c[key]
@@ -695,7 +767,7 @@ def cb_story_end(args):
entry['comments'] = readComments(entry, config)
if entry.has_key('comments'):
for comment in entry['comments']:
- renderer.outputTemplate(output, comment, 'comment')
+ renderer.outputTemplate(output, comment, 'comment')
if form.has_key('preview')\
and renderer.flavour.has_key('comment-preview'):
com = build_preview_comment(form, entry)
diff --git a/www-apps/pyblosxom-plugins/files/digest-pyblosxom-plugins-1.3.2 b/www-apps/pyblosxom-plugins/files/digest-pyblosxom-plugins-1.3.2
index e69de29..8b13789 100644
--- a/www-apps/pyblosxom-plugins/files/digest-pyblosxom-plugins-1.3.2
+++ b/www-apps/pyblosxom-plugins/files/digest-pyblosxom-plugins-1.3.2
@@ -0,0 +1 @@
+
diff --git a/www-apps/pyblosxom-plugins/files/logrequest.py b/www-apps/pyblosxom-plugins/files/logrequest.py
index c2e9b43..b6638d7 100644
--- a/www-apps/pyblosxom-plugins/files/logrequest.py
+++ b/www-apps/pyblosxom-plugins/files/logrequest.py
@@ -40,7 +40,7 @@ SOFTWARE.
Copyright 2004, 2005 Wari Wahab
"""
-__version__ = "$Id: logrequest.py,v 1.6.4.1 2005/04/11 15:48:01 wari Exp $"
+__version__ = "$Id: logrequest.py 883 2006-03-24 03:43:42Z willhelm $"
def cb_logrequest(args):
import os, time
diff --git a/www-apps/pyblosxom-plugins/files/pyarchives.py b/www-apps/pyblosxom-plugins/files/pyarchives.py
index ce4ad14..6a662b6 100644
--- a/www-apps/pyblosxom-plugins/files/pyarchives.py
+++ b/www-apps/pyblosxom-plugins/files/pyarchives.py
@@ -42,7 +42,7 @@ SOFTWARE.
Copyright 2004, 2005 Wari Wahab
"""
__author__ = "Wari Wahab - wari at wari dot per dot sg"
-__version__ = "$Id: pyarchives.py 750 2005-08-01 18:48:38Z willhelm $"
+__version__ = "$Id: pyarchives.py 883 2006-03-24 03:43:42Z willhelm $"
from Pyblosxom import tools
import time, os
diff --git a/www-apps/pyblosxom-plugins/files/pycalendar.py b/www-apps/pyblosxom-plugins/files/pycalendar.py
index e2ed1cc..0b76264 100644
--- a/www-apps/pyblosxom-plugins/files/pycalendar.py
+++ b/www-apps/pyblosxom-plugins/files/pycalendar.py
@@ -60,12 +60,12 @@ SOFTWARE.
Copyright 2004, 2005 Will Guaraldi
"""
__author__ = "Will Guaraldi - willg at bluesock dot org"
-__version__ = "$Id: pycalendar.py 650 2005-04-04 14:43:49Z willhelm $"
+__version__ = "$Id: pycalendar.py 883 2006-03-24 03:43:42Z willhelm $"
__url__ = "http://pyblosxom.sourceforge.net/"
__description__ = "Builds a calendar."
from Pyblosxom import tools
-import time, calendar, string, os, types
+import time, calendar, string, os
def verify_installation(request):
# there's no configuration needed for this plugin.
@@ -113,9 +113,7 @@ class PyblCalendar:
self._cal = ""
return
- view = list(entry_list[0].get("timetuple", (time.strftime("%Y", self._today),
- time.strftime("%m", self._today),
- time.strftime("%d", self._today))))
+ view = list(entry_list[0]["timetuple"])
# this comes in as 2001, 2002, 2003, ... so we can convert it
# without an issue
diff --git a/www-apps/pyblosxom-plugins/files/pycategories.py b/www-apps/pyblosxom-plugins/files/pycategories.py
index f6c57f4..d65546c 100644
--- a/www-apps/pyblosxom-plugins/files/pycategories.py
+++ b/www-apps/pyblosxom-plugins/files/pycategories.py
@@ -10,8 +10,8 @@ You can format the output by setting "category_begin", "category_item",
Categories exist in a hierarchy. "category_start" starts the category listing
and is only used at the very beginning. The "category_begin" property begins a
-new category group and the "category_end" property ends that category group. The
-"category_item" property is the template for each category item. Then
+new category group and the "category_end" property ends that category group.
+The "category_item" property is the template for each category item. Then
after all the categories are printed, "category_finish" ends the category
listing.
@@ -20,7 +20,7 @@ to close a category and <li> for each item:
py["category_start"] = "<ul>"
py["category_begin"] = "<li><ul>"
-py["category_item"] = r'<li><a href="%(base_url)s/%(category)sindex">%(category)s</a></li>'
+py["category_item"] = r'<li><a href="%(base_url)s/%(category_urlencoded)sindex">%(category)s</a></li>'
py["category_end"] = "</li></ul>"
py["category_finish"] = "</ul>"
@@ -31,20 +31,25 @@ category:
py["category_start"] = ""
py["category_begin"] = ""
-py["category_item"] = r'%(indent)s<a href="%(base_url)s/%(category)sindex">%(category)s</a> (%(count)d)<br />'
+py["category_item"] = r'%(indent)s<a href="%(base_url)s/%(category_urlencoded)sindex">%(category)s</a> (%(count)d)<br />'
py["category_end"] = ""
py["category_finish"] = ""
-There are no variables available in the category_begin or category_end templates.
+There are no variables available in the category_begin or category_end
+templates.
Available variables in the category_item template:
- base_url (this is set in your config.py file) string
- fullcategory 'dev/pyblosxom/status/' string
- category 'status/' string
- flavour 'html' string
- count 70 int
- indent '&nbsp;&nbsp;&nbsp;&nbsp;' string
+ variable example datatype
+ ======== ======= ========
+ base_url http://joe.com/blog/ string
+ fullcategory_urlencoded 'dev/pyblosxom/status/' string
+ fullcategory 'dev/pyblosxom/status/' string (urlencoded)
+ category 'status/' string
+ category_urlencoded 'status/' string (urlencoed)
+ flavour 'html' string
+ count 70 int
+ indent '&nbsp;&nbsp;&nbsp;&nbsp;' string
Permission is hereby granted, free of charge, to any person
@@ -67,10 +72,10 @@ ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
-Copyright 2004, 2005 Will Guaraldi
+Copyright 2004, 2005, 2006 Will Guaraldi
"""
__author__ = "Will Guaraldi - willg at bluesock dot org"
-__version__ = "$Id: pycategories.py,v 1.20.4.4 2005/06/14 15:36:45 willhelm Exp $"
+__version__ = "$Id: pycategories.py 883 2006-03-24 03:43:42Z willhelm $"
__url__ = "http://pyblosxom.sourceforge.net/"
__description__ = "Builds a list of categories."
@@ -79,7 +84,7 @@ import re, os
DEFAULT_START = r'<ul class="categorygroup">'
DEFAULT_BEGIN = r'<li><ul class="categorygroup">'
-DEFAULT_ITEM = r'<li><a href="%(base_url)s/%(fullcategory)sindex.%(flavour)s">%(category)s</a> (%(count)d)</li>'
+DEFAULT_ITEM = r'<li><a href="%(base_url)s/%(fullcategory_urlencoded)sindex.%(flavour)s">%(category)s</a> (%(count)d)</li>'
DEFAULT_END = "</ul></li>"
DEFAULT_FINISH = "</ul>"
@@ -111,7 +116,7 @@ class PyblCategories:
begin_t = config.get("category_begin", DEFAULT_BEGIN)
item_t = config.get("category_item", DEFAULT_ITEM)
end_t = config.get("category_end", DEFAULT_END)
- finish_t = config.get("category_start", DEFAULT_FINISH)
+ finish_t = config.get("category_finish", DEFAULT_FINISH)
self._baseurl = config.get("base_url", "")
@@ -162,7 +167,7 @@ class PyblCategories:
num = 0
for key in self._elistmap.keys():
- if key.endswith(item) or key.endswith(item + os.sep):
+ if item == '' or key == item or key.startswith(item + os.sep):
num = num + self._elistmap[key]
if not item:
@@ -186,6 +191,14 @@ class PyblCategories:
"count": num,
"indent": tab }
+ # this prevents a double / in the root category url
+ if item == "":
+ d["fullcategory"] = item
+
+ # this adds urlencoded versions
+ d["fullcategory_urlencoded"] = tools.urlencode_text(d["fullcategory"])
+ d["category_urlencoded"] = tools.urlencode_text(d["category"])
+
# and we toss it in the thing
output.append(item_t % d)