Re: [Pyblosxom-checkins] SF.net SVN: pyblosxom: [1202] trunk/contrib,

Ryan Barrett <pyblosxom-6sb6M7qyT/[email protected]> Tue, 12 Feb 2008 00:31:18 -0500 (EST)
Newsgroups gmane.comp.web.pyblosxom.user
Message-ID <[email protected]>
grant, this should fix the incompatibility you found betwen pyblosxom 1.4.3 
and comments.py from trunk. it was caused by tools.VariableDict's incomplete 
dictionary emulation. happily, 2.0 ditches VariableDict entirely.

thanks for the report!

On Mon, 11 Feb 2008, [email protected] wrote:

> Revision: 1202
>          http://pyblosxom.svn.sourceforge.net/pyblosxom/?rev=1202&view=rev
> Author:   ryanbarrett
> Date:     2008-02-11 21:23:49 -0800 (Mon, 11 Feb 2008)
>
> Log Message:
> -----------
> fix a bug tickled by 1.4.3's VariableDict code. thanks to Grant Goodyear for
> the report!
>
> Modified Paths:
> --------------
>    trunk/contrib/plugins/comments/plugins/comments.py
>    trunk/contrib/tests/plugins/comments/plugins/test_comments.py
>
> Modified: trunk/contrib/plugins/comments/plugins/comments.py
> ===================================================================
> --- trunk/contrib/plugins/comments/plugins/comments.py	2008-02-10 22:08:30 UTC (rev 1201)
> +++ trunk/contrib/plugins/comments/plugins/comments.py	2008-02-12 05:23:49 UTC (rev 1202)
> @@ -313,7 +313,7 @@
>     @param: a file entry
>     @type: dict
>     """
> -    if 'num_comments' not in entry:
> +    if not entry.has_key('num_comments'):
>         if filelist is None:
>             filelist = glob.glob(cmtExpr(entry, config))
>         entry['num_comments'] = len(filelist)
> @@ -917,10 +917,10 @@
>     request = args["request"]
>     data = request.getData()
>     config = request.getConfiguration()
> -    if len(renderer.getContent()) == 1 \
> -            and 'comment-story' in renderer.flavour \
> -            and not "nocomments" in entry \
> -            and data['display_comment_default'] == 1:
> +    if (len(renderer.getContent()) == 1
> +        and 'comment-story' in renderer.flavour
> +        and not entry.has_key("nocomments")
> +        and data['display_comment_default'] == 1):
>         template = renderer.flavour.get('comment-story','')
>         args['template'] = args['template'] + template
>
> @@ -988,7 +988,7 @@
>     form = request.getHttp()['form']
>     config = request.getConfiguration()
>     if (len(renderer.getContent()) == 1 and 'comment-story' in renderer.flavour
> -        and not "nocomments" in entry and data['display_comment_default'] == 1):
> +        and not entry.has_key('nocomments') and data['display_comment_default'] == 1):
>         output = []
>         entry['comments'] = readComments(entry, config)
>         if entry['comments']:
>
> Modified: trunk/contrib/tests/plugins/comments/plugins/test_comments.py
> ===================================================================
> --- trunk/contrib/tests/plugins/comments/plugins/test_comments.py	2008-02-10 22:08:30 UTC (rev 1201)
> +++ trunk/contrib/tests/plugins/comments/plugins/test_comments.py	2008-02-12 05:23:49 UTC (rev 1202)
> @@ -279,13 +279,13 @@
>         # only expand if we have a comment-head template
>         assert 'comment-head' not in self.renderer.flavour
>         eq_(template, comments.cb_head(self.args))
> -        assert 'title' not in self.entry
> +        assert not self.entry.has_key('title')
>
>         # don't expand if we're displaying more than one entry
>         self.renderer.flavour['comment-head'] = ''
>         self.renderer.setContent([self.entry, self.entry])
>         eq_(template, comments.cb_head(self.args))
> -        assert 'title' not in self.entry
> +        assert not self.entry.has_key('title')
>
>         # we have comment-head and only one entry. expand!
>         class MockEntry(dict):
> @@ -338,7 +338,7 @@
>
>         def check_num_comments(expected):
>             for method in (comments.cb_story, comments.cb_story_end):
> -                if 'num_comments' in self.entry:
> +                if self.entry.has_key('num_comments'):
>                     del self.entry['num_comments']
>                 method(self.args)
>                 eq_(expected, self.entry['num_comments'])
> @@ -367,11 +367,11 @@
>         check_no_comments()
>
>         self.renderer.setContent([self.entry])
> -        self.entry['nocomments'] = True
> +        self.data['display_comment_default'] = False
>         check_no_comments()
>
> -        del self.entry['nocomments']
> -        self.data['display_comment_default'] = False
> +        self.data['display_comment_default'] = True
> +        self.entry['nocomments'] = True
>         check_no_comments()
>
>     def test_cb_story_comment_story_template(self):
> @@ -427,8 +427,7 @@
>             'w3cdate': self.timestamp_w3c,
>             'date': self.timestamp_date,
>             'pubDate': self.timestamp_asc,
> -            'description_escaped': 'body=with&quot;chars',
> -            'description_urlencoded': 'body%3Dwith%22chars',
> +            'description': 'body=with"chars',
>             })
>
>         # these depends on the fact that dict.keys() and dict.values() return
> @@ -444,8 +443,6 @@
>         self.check_comment_output('comment:\n' + make_expected(), **args)
>
>         # a previewed comment
> -        del vars['description_escaped']
> -        del vars['description_urlencoded']
>         self.renderer.flavour['comment-preview'] = 'preview:\n' + make_template()
>         args['preview'] = 'yes'
>         self.check_comment_output('preview:\n' + make_expected(), **args)
>
>
> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Pyblosxom-checkins mailing list
> Pyblosxom-checkins-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> https://lists.sourceforge.net/lists/listinfo/pyblosxom-checkins
>

  -Ryan

--
http://snarfed.org/

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/