Peter's Blog 5.7.2004

2004-07-05

New Server

New server running, sshing to work and it's nice much faster that the old laptop was. It also runs quiter, the old laptop fan did not come on all the time but when it did it was like a vacuum cleaner. Yeah Gentoo.

posted at 16:21:36    #    comment []    trackback []
 

New Server

First post from Python Desktop Server running on my new server under Gentoo. If you can read this then it is working!

I think I'm uncovering a little shortcoming of Gentoo. I had to tweak the source for PyDS to get this running and I cannot install PHP because the build fails.

Does a Gentoo user spend most of their time fixing bugs???

posted at 15:58:08    #    comment []    trackback []
 

PyDS and Gentoo

I've tried the Python Desktop Server package in Gentoo and had problems with the Wiki. Trying to look at a Wiki entry would give an error like this:

Exception exceptions.AttributeError: HTMLFragmentWriter instance has no attribute 'visitor'
File                 Line      Function         Source
Tool.py              935       process_request  s = getattr(tool,meth)(req)
WikiTool.py          376       show_html        homeTool = self)
Tool.py              744       renderText       homeTool=kw.get('homeTool')
StructuredText.py    201       renderText       settings_overrides={
core.py              382       publish_string   return pub.publish(enable_exit=enable_exit)
core.py              186       publish          self.writer.assemble_parts()
html4css1.py         115       assemble_parts   self.parts[part] = ''.join(getattr(self.visitor, part))

(note that I had to force traceback dumping in docutils to get this much detail. I did this by adding self.settings.traceback = 1 to publisher.publish).

Poking around, the problem appears to be with the new version of docutils (which appears to be dev-python/docutils-0.3-r1 [0.3.3]). The problem is that the code in html4css1.Writer.Translate has changed from:

def translate(self):
    
visitor = self.translator_class(self.document)
    
self.document.walkabout(visitor)
    
self.output = visitor.astext()
    
self.head_prefix = visitor.head_prefix
    
self.stylesheet = visitor.stylesheet
    
self.head = visitor.head
    
self.body_prefix = visitor.body_prefix
    
self.body_pre_docinfo = visitor.body_pre_docinfo
    
self.docinfo = visitor.docinfo
    
self.body = visitor.body
    
self.body_suffix = visitor.body_suffix

to:

def translate(self):
    
visitor = self.translator_class(self.document)
    
self.document.walkabout(visitor)
    
self.output = visitor.astext()
    
self.visitor = visitor
    
for attr in ('head_prefix', 'stylesheet', 'head', 'body_prefix',
                 
'body_pre_docinfo', 'docinfo', 'body', 'fragment',
                 
'body_suffix'):
        
setattr(self, attr, getattr(visitor, attr))

Hidden in the new form is the line:

self.visitor = visitor

This is not being done in the PyDS version of this function HTMLFragmentWriter.translate:

def translate(self):
    
visitor = self.translator_class(self.document,
        
section_level=self.section_level,
        
suppress_paragraphs=self.suppress_paragraphs
    
)
    
self.document.walkabout(visitor)
    
self.output = visitor.astext()
    
self.head_prefix = visitor.head_prefix
    
self.head = visitor.head
    
self.body_prefix = visitor.body_prefix
    
self.body = visitor.body
    
self.body_suffix = visitor.body_suffix

Adding the following line:

self.visitor = visitor

to this seems to fix the Wiki problem. Sorry for lack of diffs, patches or whatever. I'm taking baby steps in OSS development.

The Mesh tool is still broken. It gives:

Exception exceptions.KeyError: '__hash__'
File             Line  Function         Source
Tool.py          915   process_request  s = tool.index_html(req)
MeshTool.py      855   index_html       toolHasSig[tool] = False
NuggetsTool.py   263   __getattr__      else: raise KeyError(name)

I may look into this some other time. I don't use the mesh tool as I'm not sure what it does.

posted at 15:11:12    #    comment []    trackback []
July 2004
MoTuWeThFrSaSu
    1 2 3 4
5 6 7 8 91011
12131415161718
19202122232425
262728293031 
Jun
2004
 Aug
2004

A blog documenting Peter's dabblings with Python, Gentoo Linux and any other cool toys he comes across.

XML-Image Letterimage

© 2004, Peter Wilkinson

Bisi and me