Toby Smithe | 10 Jun 23:17

Help debugging pingbacks

Hi,

I'm trying to fix up autopingback.py so that I can eventually think
about getting it into a plugin, and whilst I've now fixed it so that
it can send the request, when xmlrpclib receives the response object,
expat dies on trying to parse it. This is because, for some reason,
the stream (handled by xmlrpclib.Transport.request with the line
"h.getfile()") is not just HTTP. Instead, I get "33\n" twice, followed
by the config dict, then the expected information (Content-Type,
Content-Length and the xmlrpc response). The stream thus looks
something like

33
33
{ ....
... "config" : "stuff" ...
... }
Content-Type: text/xml
Content-Length: 226

<?xml version='1.0'?>
<methodResponse>
...
...
</methodResponse>

When I look in the "xmlrpc.py" plugin at the data at
xmlrpc.XMLRPCHandler._request.getResponse(), I only have the xml
returned in the stream. This suggests that somewhere between the
xmlrpc plug-in and autoping.py, the data is being mangled. It doesn't
(Continue reading)

Toby Smithe | 9 Jun 23:24

comment.py: send_email dies when called from pingback

Hi,

because pingbacks do not set the "comment_smtp_from" variable,
send_email dies in the case (like mine) where the user has not set
that variable in the config dict. I've applied the following patch,
but I realise it may be undesirable. However, it makes more sense for
me for the comments to be SMTP From the given e-mail, using the
configured value as a fall-back, and the "to" value as a last resort.
In any case, I don't like that there is a use-case where the function
can fail.

=== modified file 'plugins/comments.py'
--- plugins/comments.py 2009-06-06 11:08:52 +0000
+++ plugins/comments.py 2009-06-09 21:08:05 +0000
@@ -499,10 +503,13 @@
     description = escape_SMTP_commands(comment['description'])
     ipaddress = escape_SMTP_commands(comment.get('ipaddress', '?'))

-    if 'comment_smtp_from' in config:
-        email = config['comment_smtp_from']
-    else:
+    try:
         email = escape_SMTP_commands(clean_author(comment['email']))
+    except:
+        if 'comment_smtp_from' in config:
+            email = config['comment_smtp_from']
+        else:
+            email = config['comment_smtp_to']

     try:
(Continue reading)

Toby Smithe | 6 Jun 17:40

[patch] Catch an exception when processing metadata in entries

Hey,

I've just come across a bug that means PyBlosxom (trunk, r1318) dies
when it encounters a meta ("#") line in an entry that does not have
the full key-value pair. Here's a simple patch to catch that, save the
data, and print a warning to stderr.

Index: pyblosxom/Pyblosxom/pyblosxom.py
===================================================================
--- pyblosxom/Pyblosxom/pyblosxom.py	(revision 1318)
+++ pyblosxom/Pyblosxom/pyblosxom.py	(working copy)
@@ -994,7 +994,11 @@
         meta = lines.pop(0)
         meta = meta[1:].strip()     # remove the hash
         meta = meta.split(" ", 1)
-        entryData[meta[0].strip()] = meta[1].strip()
+        try:
+            entryData[meta[0].strip()] = meta[1].strip()
+        except:
+            print >>sys.stderr, "meta %s has no data in %s" %
(meta[0], filename)
+            entryData[meta[0].strip()] = ""

     # Call the preformat function
     args = {'parser': entryData.get('parser', config.get('parser', 'plain')),

Regards,

--

-- 
Toby Smithe :: http://fulltinreality.com
(Continue reading)

Toby Smithe | 5 Jun 17:42

Arbitrary python evaluation in entries etc

Hi,

I discussed on IRC the possibility of abstracting arbitrary python
execution as found in pystaticfile.py (eval_python_blocks) into the
core. This was rightly deemed a bad idea, and that the functionality
should go into a plugin. So, I took the code from pystaticfile, messed
it up, and put it in a plugin that will run over any rendered file. If
this is acceptable, the code in pystaticfile and pyinclude becomes
obsolete.

http://fulltinreality.com/dev/pyblosxom/python-entries.py

--

-- 
Toby Smithe :: http://fulltinreality.com

------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
Toby Smithe | 5 Jun 03:25

bzrblosxom.py: Get entry date from bzr

Hi all,

Modeled on Lennart Poettering's pyblosxom-svn[1] plugin, I have
written a new plugin to do the same, but for Bazaar branches. It might
be nice to throw in the registry if not the file, then a link to [2],
where I host it.

[1] http://0pointer.de/blog/projects/pyblosxom-svn.html
[2] http://fulltinreality.com/dev/pyblosxom/bzrblosxom.py

Good night,

--

-- 
Toby Smithe :: http://fulltinreality.com

------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
Andrey Bondarenko | 2 Jun 12:59
Favicon

FileEntry does not overide getMetadataKeys

Hi,

I have found that FileEntry does not override getMetadataKeys
inherited from BaseEntry. I think it is a bug. If you try to 
iterate over entry keys without accessing some entry item
first, you will get only small portion of keys available for
the entry.

The following method implementation fixes the issue for me.

    def getMetadataKeys(self):
       if self._populated_data == 0:
            self.__populatedata()

        return base.EntryBase.getMetadataKeys(self)

Thanks,
Andrey 

------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
Toby Smithe | 29 May 01:10

New plugin: randompic.py

Hi,

I developed a very simple plug-in to choose a random image from a
pre-configured directory, and save its name in a variable. I thought
I'd contribute it as it could be useful to someone else, and it's sad
to see "portico" all alone in the "images" section of the plug-in
registry.

The script is attached, and it is licensed "MIT", with copyright
attributed to myself. See the file for more information.

Regards,

--

-- 
Toby Smithe :: http://fulltinreality.com
Attachment (randompic.py): text/x-python, 1969 bytes
------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT 
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, & 
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian 
Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com 
_______________________________________________
Pyblosxom-devel mailing list
Pyblosxom-devel@...
https://lists.sourceforge.net/lists/listinfo/pyblosxom-devel
(Continue reading)

Marius Gedminas | 16 May 16:38
Gravatar

Comments plugin and categories

I don't use categories on my blog.  The comments.py plugin assumes that
I do and has checks in cb_story and cb_story_end that skip the rendering
of comments if entry['absolute_path'] is an empty string.

I think it's trying to avoid the displaying of comments if you're
looking at a category which has exactly one post in it.  Is there really
no better way to distinguish looking at a single post from looking at a
list of posts?

Marius Gedminas
--

-- 
There's something about hitting send that makes every error I have made light
up in a bright "it's too late to do anything about this" neon.
        -- James Nicoll
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables 
unlimited royalty-free distribution of the report engine 
for externally facing server and web deployment. 
http://p.sf.net/sfu/businessobjects
_______________________________________________
Pyblosxom-devel mailing list
Pyblosxom-devel@...
https://lists.sourceforge.net/lists/listinfo/pyblosxom-devel
Marius Gedminas | 16 May 16:51
Gravatar

Comments plugin and AJAXy posts

If you enable AJAX form submission for the comments plugin, hitting the
'Submit' button will return "Empty response from server".

This is caused by (oh dear) an unfortunate interaction of the pieces.

cb_renderer notices the AJAX submission and switches to AjaxRenderer.
Which tries to avoid filtering bits of the output to get only the
single comment.  Unfortunately, since rendering cb_story is what *loads*
the comments, when we get to cb_story_end we have entry['comments'] is
None and thus no output.

I fixed it by patching cb_story_end and adding

        if entry['num_comments'] is None:
            # During AJAX rendering we skip cb_story which would load the
            # comments, so do that here
            entry['comments'] = readComments(entry, config)
            entry['num_comments'] = len(entry['comments'])

just in front of

        if entry['comments']:

This fix is sufficient if you don't have comment approval enabled.  It
is not sufficient if comment_draft_ext != comment_ext.  In the latter
case I looked at how comment preview was implemented and did the same
thing, by rendering a new comment-moderated template that says "Comment was
submitted for approval. Thanks!":

Index: plugins/comments.py
(Continue reading)

Marius Gedminas | 16 May 16:56
Gravatar

Comments and HTML sanitization

I'm unhappy by the sanitization applied to the comment text:

  * There seems to be no way to talk about HTML tags in the comments.
    If you type '&lt;pre&gt;', this gets escaped and the produces HTML
    is  &amp;lt;pre&amp;gt;.  If you type '<pre>' this is not escaped
    and leaks into the output directly as '<pre>'.

  * The logic that inserts '<br />' on every newline breaks preformatted
    text.   If I type

    <pre>
      if foo:
          bar()
    </pre>

    that is converted to

    <pre><br />
      if foo:<br />
          bar()<br />
    </pre><br />

    resulting in double-spaced look.

Does the comments plugin have any unit tests?

Would it be possible to hook in some markup processor to avoid the
hassle of fixing this?  I'm not familiar with many markup languages
(except to say ReStructuredText is not friendly to non-programmers), but
Markdown seemed kind of nice.
(Continue reading)

Andrey Bondarenko | 28 Apr 14:09
Favicon

Entry content as unicode

Hi everyone,

I'm trying to implement a SimpleTAL-based renderer plugin for pyblosxom.
SimpleTAL requires TALES context contain only Unicode strings, but most
of entry parsers read entry content as byte strings without conversion.

Currently I'm converting to Unicode within the the plugin, but I'm not sure
which encoding should I use. Should I get it from blog locale or from
blog_encoding parameter?

P.S.
It is probably better to do conversion in entry parsers, but in this case
we need to modify entry parsers plugin, am I right?

Thanks,
Andrey Bondarenko

------------------------------------------------------------------------------
Register Now & Save for Velocity, the Web Performance & Operations 
Conference from O'Reilly Media. Velocity features a full day of 
expert-led, hands-on workshops and two days of sessions from industry 
leaders in dedicated Performance & Operations tracks. Use code vel09scf 
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf

Gmane