[Moin-user] editlog and RecentChanges RSS
Fujio Nobori
toh at fuji-climb.org
Wed Apr 7 18:42:03 EDT 2004
Hello,
I encountered this issue, too.
I know the attached patch solves this issue, but I am not
sure if this is the right fix...
What I did is to override startElementNS() method of
XMLGenerator class in python2.3/xml/sax/saxutils.py, because
it cannot handle attr like:
{(None, 'link'): 'http://someurl'}
I mean, the first value in tuple cannot be None.
This value is set in action/rss_rc.py, so this might be
where the problem resides.
Thomas (or some other developer), would you please give us
the right fix? The RSS feature is, I think, really
important for many people.
--
Fujio Nobori il|li
email: toh at fuji-climb.org q|@.@|p
m. ( o ) .m
~~~~~~~~~~~~~
On Thu, Feb 26, 2004 at 06:16:26PM -0800, ms419 at freezone.co.uk wrote:
> I've two Moin installations, one for which the RecentChanges RSS works
> and one for which it doesn't ...
>
> Accessing the broken RSS feed -
> /RecentChanges?action=macro¯o=RecentChanges&do=rss_rc - reports the
> following:
>
> Please include this information in your bug reports!:
> Python 2.2.1 (#1, Aug 10 2002, 15:08:14) [GCC 2.95.3 20010315 (release)
> [FreeBSD]] - /usr/local/bin/python
> FreeBSD ren.resnet.sfu.ca 4.6-RELEASE FreeBSD 4.6-RELEASE #2: Mon Sep
> i386
> MoinMoin Release 1.1 [Revision 1.178]
>
> A problem occurred while running a Python script. Here is the sequence
> of function calls leading up to the error, with the most recent
> (innermost) call first. The exception attributes are:
> ??????__doc__?= 'Mapping key not found.'
> ??????__getitem__?= <bound method KeyError.__getitem__ of
> <exceptions.KeyError instance at 0x82a054c>>
> ??????__init__?= <bound method KeyError.__init__ of
> <exceptions.KeyError instance at 0x82a054c>>
> ??????__module__?= 'exceptions'
> ??????__str__?= <bound method KeyError.__str__ of <exceptions.KeyError
> instance at 0x82a054c>>
> ??????args?= ()
>
> /usr/local/lib/python2.2/xml/sax/saxutils.py in
> startElementNS(self=<MoinMoin.wikixml.util.RssGenerator instance>,
> name=(None, 'link'), qname='rdf:Description', attrs={(None, 'link'):
> 'http://rha.resnet.sfu.ca/rha/JackBates',
> ('http://purl.org/rss/1.0/modules/wiki/', 'host'):
> u'sfpirg6.stdntsvcs.sfu.ca'})
> ??101?
> ??102?????????for?(name,?value)?in?attrs.items():
>
>
> ??103?????????????name?=?self._current_context[name[0]]?+?":"?+?name[1]
>
> ?????? name?= (None, 'link'), self?=
> <MoinMoin.wikixml.util.RssGenerator instance>, global
> _current_context?= undefined
> ??104?????????????self._out.write('?%s=%s'?%?(name,?quoteattr(value)))
> ??105?????????self._out.write('>')
>
>
> /home/rha/lib/python/MoinMoin/wikixml/util.py in
> startNode(self=<MoinMoin.wikixml.util.RssGenerator instance>,
> tag=('http://www.w3.org/1999/02/22-rdf-syntax-ns#', 'Description'),
> attr={(None, 'link'): 'http://rha.resnet.sfu.ca/rha/JackBates',
> ('http://purl.org/rss/1.0/modules/wiki/', 'host'):
> u'sfpirg6.stdntsvcs.sfu.ca'})
> ???32?????def?startNode(self,?tag,?attr={}):
> ???33?????????tag,?qname?=?self._build_tag(tag)
>
>
> ???34?????????self.startElementNS(tag,?qname,?attr)
>
> ?????? self?= <MoinMoin.wikixml.util.RssGenerator instance>, global
> startElementNS?= undefined, tag?=
> ('http://www.w3.org/1999/02/22-rdf-syntax-ns#', 'Description'), qname?=
> 'rdf:Description', attr?= {(None, 'link'):
> 'http://rha.resnet.sfu.ca/rha/JackBates',
> ('http://purl.org/rss/1.0/modules/wiki/', 'host'):
> u'sfpirg6.stdntsvcs.sfu.ca'}
> ???35?
> ???36?????def?endNode(self,?tag):
>
>
> /home/rha/lib/python/MoinMoin/macro/RecentChanges.py in
> do_rss_rc(pagename='RecentChanges', request=<MoinMoin.request.Request
> instance>)
> ??460?????????????????##edattr[(None,?'link')]?=?link?+?"?action=info"
> ??461?????????????handler.startNode(('dc',?'contributor'))
>
>
> ??462?????????????handler.startNode(('rdf',?'Description'),?attr=edattr)
>
> ?????? handler?= <MoinMoin.wikixml.util.RssGenerator instance>, global
> startNode?= undefined, global attr?= undefined, edattr?= {(None,
> 'link'): 'http://rha.resnet.sfu.ca/rha/JackBates',
> ('http://purl.org/rss/1.0/modules/wiki/', 'host'):
> u'sfpirg6.stdntsvcs.sfu.ca'}
> ??463?????????????handler.simpleNode(('rdf',?'value'),?edname)
> ??464?????????????handler.endNode(('rdf',?'Description'))
>
>
> /home/rha/lib/python/MoinMoin/wikimacro.py in
> execute_external_macro(macro_name='RecentChanges',
> function='do_rss_rc', args=('RecentChanges', <MoinMoin.request.Request
> instance>))
> ???69?????if?macro_name?in?macro.extension_macros:
>
> ???70?????????execute?=?pysupport.importName("MoinMoin.macro."?+?macro_n
> ame,?function)
>
>
> ???71?????????return?execute(*args)
>
> ?????? execute?= <function do_rss_rc>, args?= ('RecentChanges',
> <MoinMoin.request.Request instance>)
> ???72?
> ???73?????#?try?plugin?dir
>
>
> /home/rha/lib/python/MoinMoin/wikiaction.py in
> do_macro(pagename='RecentChanges', request=<MoinMoin.request.Request
> instance>)
> ??687?????function?=?'do_'?+?request.form["do"].value
> ??688?
>
>
> ??689?????wikimacro.execute_external_macro(macro_name,?function,?(pagena
> me,?request))
>
> ?????? wikimacro?= <module 'MoinMoin.wikimacro' from
> '/home/rha/lib/python/MoinMoin/wikimacro.pyc'>, global
> execute_external_macro?= undefined, macro_name?= 'RecentChanges',
> function?= 'do_rss_rc', pagename?= 'RecentChanges', request?=
> <MoinMoin.request.Request instance>
> ??690?
> ??691?
>
>
> /home/rha/lib/python/MoinMoin/cgimain.py in run(properties={})
> ??210?????????else:
> ??211?????????????try:
>
>
> ??212?????????????????cgitb.handler()
>
> ?????? cgitb?= <module 'MoinMoin.support.cgitb' from
> '/home/rha/lib/python/MoinMoin/support/cgitb.pyc'>, handler?= <function
> do_macro>
> ??213?????????????except:
> ??214?????????????????cgi.print_exception(*saved_exc)
>
> As far as I can tell, the important difference between the two is the
> fifth field of the edit log:
>
> FrontPage 65.110.29.189 1077509118.3026841 cust-65-110-29-189.sfu-
> resnet.connectwest.net 1077471682.08.79218 executive.jpg ATTNEW
> Calendar 65.110.29.189 1077510724 cust-65-110-29-189.sfu-
> resnet.connectwest.net 1077471682.08.79218 SAVE
> FrontPage 65.110.29.189 1077510761 cust-65-110-29-189.sfu-
> resnet.connectwest.net 1077471682.08.79218 SAVE
>
> If I remove it, the RecentChanges RSS works ...
>
> Why's it there? In only one case?
>
> Thanks!
>
> Jack
>
>
>
> -------------------------------------------------------
> SF.Net is sponsored by: Speed Start Your Linux Apps Now.
> Build and deploy apps & Web services for Linux with
> a free DVD software kit from IBM. Click Now!
> http://ads.osdn.com/?ad_id56&alloc_id438&op=click
> _______________________________________________
> Moin-user mailing list
> Moin-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/moin-user
>
-------------- next part --------------
--- orig/MoinMoin/wikixml/util.py
+++ mod/MoinMoin/wikixml/util.py
@@ -50,6 +50,32 @@
self.endPrefixMapping(prefix or None)
saxutils.XMLGenerator.endDocument(self)
+ def startElementNS(self, name, qname, attrs):
+ # this code is a bit modified version of python2.3/xml/sax/saxutils.py
+ # i needed this because startElementNS() in saxutils.py
+ # cannot handle attr whose name[0] is None, and action/rss_rc.py
+ # set this to None (ex. name = (None, 'link')).
+ if name[0] is None:
+ # if the name was not namespace-scoped, use the unqualified part
+ name = name[1]
+ else:
+ # else try to restore the original prefix from the namespace
+ name = self._current_context[name[0]] + ":" + name[1]
+ self._out.write('<' + name)
+
+ for pair in self._undeclared_ns_maps:
+ self._out.write(' xmlns:%s="%s"' % pair)
+ self._undeclared_ns_maps = []
+
+ for (name, value) in attrs.items():
+ if name[0] is None:
+ # if the name was not namespace-scoped, use the unqualified part
+ name = name[1]
+ else:
+ name = self._current_context[name[0]] + ":" + name[1]
+ self._out.write(' %s=%s' % (name, saxutils.quoteattr(value)))
+ self._out.write('>')
+
class RssGenerator(XMLGenerator):
default_xmlns = {
More information about the Moin-user
mailing list