Comment message patch for comments.py

Michael Olson <mwolson-mXXj517/[email protected]>
Newsgroups gmane.comp.web.pyblosxom.user
Message-ID <[email protected]>
In the process of honing my Gray theme, I came across the
$comment_message variable.  Enclosed is a patch against the version of
comments.py included with plugin pack 1.3 that sets meaningful values
for this variable in some situations.

Note: I could be missing the point with the first diff hunk.  If so,
please let me know.


-- 
Michael Olson -- FSF Associate Member #652 -- http://www.mwolson.org/
Interests: Emacs Lisp, text markup, protocols -- Jabber: mwolson_at_hcoop.net
  /` |\ | | | Projects: Emacs, Muse, ERC, EMMS, Planner, ErBot, DVC
 |_] | \| |_| Reclaim your digital rights by eliminating DRM.
      See http://www.defectivebydesign.org/what_is_drm for details.

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

_______________________________________________
pyblosxom-users mailing list
pyblosxom-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/pyblosxom-users
signature.asc (application/pgp-signature, 188 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)

iD8DBQFFMoGs+1Ho2POo0xkRAi/zAJ9e5Tj9pzqnBujrtoPnPMnX0SK/AgCeKYLK
IZ5pElILsFUhDvhZ1aBqaqU=
=bi1B
-----END PGP SIGNATURE-----
comments.diff (application/octet-stream, 1.3 KB)
--- comments.old.py	2006-05-31 00:01:35.000000000 -0400
+++ comments.py	2006-10-15 03:20:34.000000000 -0400
@@ -356,7 +356,7 @@
                                 donefunc=lambda x:x != 0)
 
     if (isinstance(reject, tuple) or isinstance(reject, list)) and len(reject) == 2:
-        reject_code, reject_message = reject
+        reject_code, reject_message = reject, "Comment rejected."
     else:
         reject_code, reject_message = reject, "Comment rejected."
 
@@ -642,8 +642,12 @@
  
     # 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"):
+    if form.has_key("post"):
+        if not (form.has_key("title") and form.has_key("author") and \
+                    form.has_key("body") and not form.has_key("preview")):
+            data['comment_message'] = \
+                "Please fill out at least the Name and Comment fields."
+            return
 
         encoding = config.get('blog_encoding', 'iso-8859-1')
         decode_form(form, encoding)
@@ -748,6 +752,7 @@
     if form.has_key("email"):
         c['cmt_email'] = form['email'].value
     for key in c: entry[key] = c[key]
+    entry['comment_message'] = "A preview of your comment is available above."
 
     return c
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.