Dne čtvrtek, 5. května 2005 04:58 Cyrille Bonnet <[EMAIL PROTECTED]> napsal(a):
> Hi all,
> I am trying to perform a post-processing on all HTTP responses, before
> they get sent to the browsers. I am using Zope 2.7.3 nad Plone 2.0.5.
> I had a look at the ZServer class: it seems to be the right place, but I
> don't understand all the code there and I am afraid to break something :-(
> Am I on the right tracks there? Could someone with great Zope knowledge
> be kind enough to point out which method I should change? (I want to
> change the HTML content, not the headers).

I have unitws product (from somebody else) which does modifications 
on the resulted html code. It is able to do any 
modifications, I was modify them to do wml compliant 
national characters and more.

You call it simple with 

your content here

Place this file __init__.py into "unitws" folder of your Products:

# cat /var/zope/lib/python/Products/unitws/__init__.py
from string import split, strip, join, find
import DocumentTemplate.DT_Util
from DocumentTemplate.DT_String import String

class UnitWhitespaceTag:
    Removes redundant whitespace (not very conservatively)


    def __init__(self, blocks):
        tname, args, section = blocks[0]
        args = DocumentTemplate.DT_Util.parse_params(args)
        self.blocks = section.blocks

    def render(self,md):
        a = []
        for line in split(DocumentTemplate.DT_Util.render_blocks(self.blocks, 
            line = strip(line)
            if line:
                b = []
                for word in split(line,' '):
                    if word!='':
                a.append(join(b,' '))
        return join(a,'\n')




                        Jaroslav Lukesh
  This e-mail can not contain any viruses because I use Linux

Zope maillist  -  Zope@zope.org
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-dev )

Reply via email to