[Moin-devel] Formatter Troubles

Ken Kinder kkinder at rackspace.com
Wed Oct 16 07:14:05 EDT 2002


On Tue, 2002-10-15 at 18:42, Tim Bird wrote:
>> This is the same thing that happens, in some circumstances, under
>> PyApache. I guess it has something to do with the way moin emits
>> its text, some time using sys.stdout.write, some time using print
>> statements: some parts of moin replace sys.stdout to get the output
>> of "subparts" (macros for example).
>> 
>> I've spent some time to track the problem, with out luck.
> 
> I'm just guessing, but maybe you need to flush whatever you're
> writing to, right after your write:
> 
> sys.stdout.flush()
> 
> With all the streams being replaced and substituted, I wouldn't
> be at all surprised to see stuff left in output buffers and not
> making to the network socket in program write order.
> 

No, that really isn't it. I've confirmed that if I have:

   This part is normal. '''This part is bold.'''

The method that invokes the strong highlighting *really*is* called
before the method that prints the text:

  -- formatter.strong is called to open
  -- formatter.strong is called to close
  -- formatter.rawtext (one I added) is called with "This part is
normal. This part is bold."

You see, I don't actually print the text as I go. In order to make sure
I produce proper XML, nothing is actually printed until
formatter.endDocument.

It seems that upon further investigation of the source code, the parser
is calling the formatter on strong tags and then *inserting* whatever it
returns into the text, before calling formatter.rawtext -- although this
answers my question, it doesn't really solve my problem.

I'm asking for advice on what the best way to build a document using
DOM. This process doesn't seem to fit into the formatter method because
of the problem I describe above.

-- 
Ken Kinder
Requirements Manager; Core Team -- Rackspace Managed Hosting(tm)
210-892-4025 x1095





More information about the Moin-devel mailing list