[Moin-user] 'module' objecthasno attribute'expat' whensavingfrom gui editor

David Cramer dcramer at motive.com
Fri Jan 9 16:22:58 EST 2009


Ok, on the Linux box I was using before, I installed python 2.4.5 from
source and moinmoin 1.8.1, and moved the wikis back there. After
removing the 4Suite and PyXML rpms and reinstalling them from source, I
got the gui editor and render as docbook working at the same time. 

I also figured out why Render as DocBook wasn't working with includes.
There was a small but important detail I had neglected to mention (and
had in fact forgotten about). I had made a small modification to the
include macro to cause an "edit" link to appear by the included page's
heading:

192,195c192
<                     macro.formatter.heading(1, level, id=heading) +
<                     "<span style='font-size: .5em'> " +
<                     inc_page.link_to(request, '[%s]' % (_('edit'),),
css_class="include-edit-link", querystr={'action': 'edit', 'backto':
request._Include_backto}) +
<                     "</span> ",
---
>                     macro.formatter.heading(1, level, id=heading), 

When I remove that, Render as DocBook works (tho it makes me sad to lose
the edit link). 

Poking around I see that there's an editlink switch for the Include
macro, however there's a bug that it doesn't appear when there's a
"heading" option included:
http://moinmo.in/MoinMoinBugs/IncludeEditLinkFails and in any case, I
just did some tests and find that using editlink causes the DocBook
formatter to fail. 

What I need to do is something like this (where if not (docbook_mode) is
checking to see if we're using the docbook formatter): 

                if not (docbook_mode):
                    result.extend([
                        macro.formatter.heading(1, level, id=heading) +
                        "<span style='font-size: .5em'> " +
                        inc_page.link_to(request, '[%s]' % (_('edit'),),
css_class="include-edit-link", querystr={'action': 'edit', 'backto':
request._Include_backto}) +
                        "</span> ",
                        macro.formatter.url(1, url,
css="include-heading-link"),
                        macro.formatter.text(heading),
                        macro.formatter.url(0),
                        macro.formatter.heading(0, level),
                    ])
                if (docbook_mode):
                    result.extend([
                        macro.formatter.heading(1, level, id=heading),
                        macro.formatter.url(1, url,
css="include-heading-link"),
                        macro.formatter.text(heading),
                        macro.formatter.url(0),
                        macro.formatter.heading(0, level),
                    ])

I see earlier in the file there a line:

print_mode = request.action in ("print", "format")

But adding a similar line for docbook doesn't work. Is there a way I can
tell the name of the current formatter? 

Anyway, now if I clean up things on the Solaris box and reinstall from
python 2.5.4 etc source rather than from packages I should be able to
get it to work. I've learned an important lesson about relying on
packages from sunfreeware :-) 

Thanks,
David

> -----Original Message-----
> From: David Cramer 
> Sent: Thursday, January 08, 2009 2:50 PM
> To: Thomas Waldmann; Mail at Heavy.ch; moin-user at lists.sourceforge.net
> Subject: Re: [Moin-user] 'module' objecthasno 
> attribute'expat' whensavingfrom gui editor
> 
> Thanks Thomas and Marcel. Yes, I had installed Python 2.5 
> from a package I got from Sunfreeware, which I understand now 
> was a bad idea. What I think I'll do is install moinmoin 
> 1.8.1 on the linux box where they used to live, move the 
> wikis back there for the time being (and redirect wiki 
> traffic to that host), then reinstall fresh copies of python, 
> moinmoin, etc on the Solais box and mess with it till I can 
> get it working right so I won't dirupt people using the wiki.
> 
> Could be a few weeks till I get to that. I think we can limp 
> along without a gui editor and with limited functionality in 
> the render as docbook feature until then though. 
> 
> Thanks,
> David
> 
> > -----Original Message-----
> > From: Thomas Waldmann [mailto:tw-public at gmx.de]
> > Sent: Thursday, January 08, 2009 2:31 AM
> > To: moin-user at lists.sourceforge.net
> > Subject: Re: [Moin-user] 'module' object hasno attribute'expat' 
> > whensavingfrom gui editor
> > 
> > 
> > > [Wed Jan 07 23:38:14 2009] [error] [client 135.115.133.210]   File
> > > "/usr/local/lib/python2.5/sha.py", line 6, in <module>
> > > [Wed Jan 07 23:38:14 2009] [error] [client 
> 135.115.133.210]     from
> > > hashlib import sha1 as sha
> > > [Wed Jan 07 23:38:14 2009] [error] [client 135.115.133.210]   File
> > > "/usr/local/lib/python2.5/hashlib.py", line 133, in <module> [Wed 
> > > Jan 07 23:38:14 2009] [error] [client 135.115.133.210]
> >     md5 =
> > > __get_builtin_constructor('md5')
> > > [Wed Jan 07 23:38:14 2009] [error] [client 135.115.133.210]   File
> > > "/usr/local/lib/python2.5/hashlib.py", line 60, in 
> > > __get_builtin_constructor [Wed Jan 07 23:38:14 2009] 
> [error] [client 
> > > 135.115.133.210]
> >     import
> > > _md5
> > > [Wed Jan 07 23:38:14 2009] [error] [client 135.115.133.210]
> > ImportError:
> > > No module named _md5
> > 
> > Looks like your python2.5 was not compiled with the usual stuff, it 
> > misses md5 support. Maybe you have to install some 
> additional headers 
> > for that stuff before compiling python (on linux, that stuff is 
> > usually in the *-dev packages).
> > 
> > BTW, if you have to compile again anyway, maybe use the 
> latest 2.5.x 
> > version.
> > 
> > 
> > 
> > --------------------------------------------------------------
> > ----------------
> > Check out the new SourceForge.net Marketplace.
> > It is the best place to buy or sell services for just about 
> anything 
> > Open Source.
> > http://p.sf.net/sfu/Xq1LFB
> > _______________________________________________
> > Moin-user mailing list
> > Moin-user at lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/moin-user
> > 
> 
> --------------------------------------------------------------
> ----------------
> Check out the new SourceForge.net Marketplace.
> It is the best place to buy or sell services for just about 
> anything Open Source.
> http://p.sf.net/sfu/Xq1LFB
> _______________________________________________
> Moin-user mailing list
> Moin-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/moin-user
> 




More information about the Moin-user mailing list